Search code examples
javascripttestingappiumwebdriver-io

How to use driver object in webdriverio with appium


While testing with appium and webdriverio, there should be a driver global object like the browser object, but when I try using it the test doesn't compile because it doesn't exist! it's mentioned here:

https://webdriver.io/docs/browserobject.html

and it's needed for all appium's native commands in here:

https://webdriver.io/docs/api/appium.html

But I don't know how to get it working. (for the browser object I just use it, although the IDE doesn't recognize it, but it works, on contrast to the driver object)

Edit: I tried using browser object in place of driver and it worked for browser.isMobile and browser.lock(5) (it locked the screen for 5 seconds), but I didn't try the more advanced uses yet (as switching the context for example) so my question: is there a difference between driver and browser?!


Solution

  • console.log(browser === driver);
    > true 
    

    so both should be basically the same.