appium-inspector icon indicating copy to clipboard operation
appium-inspector copied to clipboard

Driver.init is not a function ?

Open flash1108 opened this issue 1 year ago • 1 comments

This is my code, it is generated by appium-inspector

 test.js 
  const wdio = require('webdriverio');
  const caps = { ... }

  const driver = wdio.remote({
  protocol: "http",
  host: "127.0.0.1",
  port: 4723,
  path: "/wd/hub",
  desiredCapabilities: caps
});

driver.init()
  .element("~phoneField")
  .setValue("0908011111")
  .element("~passwordField")
  .setValue("abcde")
  .end();

I run it -> node test.js I get this: driver.init() ^ TypeError: driver.init is not a function

can you help me? What happened?

Environment

  • I am on (pick one):
    • [x] Mac
    • [ ] Windows
    • [ ] Linux

flash1108 avatar Jul 22 '22 02:07 flash1108

it looks like the generated code may be out of date with webdriverio. please refer to the webdriverio docs and they should show you how to start a session. you can then adjust the generated code to be correct. (and maybe raise a PR here to fix the way the code is generated?)

jlipps avatar Jul 25 '22 23:07 jlipps

@jlipps I have updated the recorder script for webdriverio with the latest documentation and raised PR #636 . Kindly review and let me know your thoughts. Thanks:)

sudharsan-selvaraj avatar Oct 16 '22 07:10 sudharsan-selvaraj