【发布时间】:2019-06-15 23:09:20
【问题描述】:
我已经成功安装并运行了appium desktop。我开始记录我的测试。录音机的输出代码如下:
// Requires the webdriverio client library
// (npm install webdriverio)
// Then paste this into a .js file and run with Node:
// node <file>.js
const wdio = require('webdriverio');
const caps = {"platformName":"android","platformVersion":"8.0","deviceName":"Nexus_6_API_26_2","automationName":"UiAutomator2","app":"path/to/my/apk"};
const driver = wdio.remote({
protocol: "http",
host: "127.0.0.1",
port: 4723,
path: "/wd/hub",
desiredCapabilities: caps
});
driver.init()
.element("/some/xpath")
.setValue("Hello World!")
.end();
但是这个设置在使用node this_test.js 运行后会发现错误
Error: Required option "capabilities" is missing
因此我将desiredCapabilities: caps 更改为capabilities: caps,但之后出现错误
TypeError: driver.init is not a function
我可以改变什么来解决这个问题?我尝试使用npm install -g webdriverio 和yarn add webdriverio 重新安装webdriverio。
我的服务器在 127.0.0.1:4723 上运行,并显示消息“URL '/' 未映射到有效资源”(如果相关)
【问题讨论】: