Transcripted Summary

WebdriverIO released version 5 of its API in December 2018. There are a few changes between version 5 and version 4. Let us take a look.

You can find version 4 documentation at v4.webdriver.io.



  • If we click on the API here, we can still see the old actions and all the properties that WebdriverIO version 4 has.

  • If we go to webdriver.io, we will get access to version 5 and if we click on the API here, it will show the new API doc.


Let us just highlight a few changes that were made.

# waitForVisible replaced with waitForDisplayed

In the new version of WebdriverIO, they have a waitForDisplayed and we discussed this in our wait strategies chapter and what it does, it waits for an element to be displayed or not displayed.

In version 4, this was called waitForVisible and it used a browser that wait for a visible and then you would pass in the selector and if you wanted to reverse it, you would say boolean true. The difference with this is that it uses the browser..

In the new version 5, you can just say selector.waitForDisplayed.


# waitForText removed

In version 4, we have a function called waitForText. This no longer exists in version 5.


# clearElement replaced with clearValue

Also, if we look here in version 4, we see clearElement and we no longer call it clearElement in version 5. We now refer to it as clearValue and as before, it removed the need to say a browser.

Instead, you can now sayselector.clearValue instead of browser.clearElement and then pass the selector that you want to use.


# addValue replaced with setValue

Similarly, we no longer have addValue from version 4. It is now in version 5 referred to as setValue.


# moveToObject replaced with moveTo

The last one that we're going to point out is the moveTo. In version 5, we say moveTo and what this does, it move to a specific offset off the selector that you specified.

In version 4, it was moveToObject — that was the name of it and you would have to say browser.moveToObject, enter your selector and your offset.


NOTE

In this project, we are using version 5. If your project already exists in version 4, you can always check the documentation to find out what the name of the command in version 4 is.



Resources