Я делаю автоматизацию одного настольного приложения, используя appium и node.
Я могу запустить приложение, используя node.js и получить свойства сеанса, такие как высота, ширина и c.
Но я, когда я вызываю исходный API, вот так
http://localhost: 4723 / wd / hub / session / 36bca4a c -b926-4c4f-af3b-65257888f833 / source
Я получаю ошибку от appium
{
"status": 13,
"value": {
"message": "An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 500 - \"\""
},
"sessionId": "36bca4ac-b926-4c4f-af3b-65257888f833"
}
Пример кода:
import * as Webdriver from 'selenium-webdriver';
import * as wd from 'wd';
let Capabilities = Webdriver.Capabilities;
(async function example() {
let driver;
try {
let webdrivercapabilities = Capabilities;
var desiredCapabilities = {
"platformName": "Windows",
"platformVersion": "",
"deviceName": "WindowsPC",
"app": "MY-APPLICATION-PASS-GOES-HERE",
"browserName": ""
};
try {
driver = new Webdriver.Builder()
.withCapabilities(new webdrivercapabilities(desiredCapabilities))
.usingServer('http://localhost:4723/wd/hub/')
.build();
} catch (error) {
}
driver.then(null, (err) => {
if (err) {
return;
}
});
driver.then(() => {
driver.getSession()
.then(function (session) {
var session_id = session.getId();
console.log(session_id);
let wddriver = wd.promiseChainRemote({
hostname: "localhost",
port: "4723",
path: "wd/hub"
});
wddriver.attach(session_id, async (success) => {
let pageSource = await wddriver.source();
console.log(pageSource);
});
});
});
}
catch(e) {
console.log(e);
}
})();
![enter image description here](https://i.stack.imgur.com/WBOi4.png)