给定类型错误:client.findElement不是函数。当试图通过javascript和mocha定位android应用程序元素时

给定类型错误:client.findElement不是函数。当试图通过javascript和mocha定位android应用程序元素时,javascript,android,mocha.js,ui-automation,webdriver-io,Javascript,Android,Mocha.js,Ui Automation,Webdriver Io,我正在尝试使用Javascript、appium、WebDrivero和Mocha查找元素。应用程序正在emulator上启动,但在定位元素时出错。是否可以使用其他方法? testclass.js文件代码如下所示: const wdio = require("webdriverio"); //example capabilities const opts = { port: 4723, capabilities: { platformName: "Android", devi

我正在尝试使用Javascript、appium、WebDrivero和Mocha查找元素。应用程序正在emulator上启动,但在定位元素时出错。是否可以使用其他方法?

testclass.js文件代码如下所示:

const wdio = require("webdriverio");


//example capabilities


const opts = {
port: 4723,
capabilities: {

  platformName: "Android",

  deviceName: "emulator-5554",

 app: "D:demo.apk",

 appPackage: "com.somepackage",

 appActivity: "com.somepackage.acivity",

newCommandTimeout: 500,

noReset: "true",

automationName: "UiAutomator2"

 }
  };

 var client =  wdio.remote(opts);


 describe('Test App launch', function () {
   this.timeout(15000);

   it('register', async function(){

// This is the error line below

  **const elm = await client.findElement("resource-id","goRegistrationButton")**

elm.click();

  });
 });
package.json文件:

{
  "name": "testclass",
  "version": "1.0.0",
  "description": "Automating app",
  "main": "testclass.js",
  "scripts": {
    "test": "testclass.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
   "mocha": "^6.0.2",
   "typescript": "^3.3.4000",
   "webdriverio": "^5.7.6"
 },
"devDependencies": {
  "ts-node": "^8.0.3"
 }
}
我希望使用javascript和webdriverIO为本机android应用程序单击元素