Driver.init is not a function?

I’ve been wrangling Appium for the better part of the past two days, and I still can’t get it to work! No tutorials seem to adress my issue. I have successfuly run Appium Desktop, from which I exported basic code like this:

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",
  capabilities: caps
});

driver.init()
  .element("/some/xpath")
  .setValue("Hello World!")
  .end();

When I run this code with node, all I get is “driver.init is not a function”. What is happening?

I am on
Ubuntu 16.04
node 10.12.0
java 1.8.0_201
adb 1.0.36
Android studio 3.2.1

1 Like

Could you figure out how to resolve this issue? I am having the exact same problem

Yes, in fact, the boilerplate shows you how. You need a different compiler.

Mainly, take a look in package.json on the testing script npm android.app or so. Notice that it doesn’t compile with node test.js, but with ./node_modules/.bin/wdio. Beware, the syntax of wdio is a little different from webdriver (but much cleaner!)