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.
**Let us just highlight a few changes that were made. **
waitForVisible replaced with
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
In the new version 5, you can just say
In version 4, we have a function called
waitForText. This no longer exists in version 5.
clearElement replaced with
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
Instead, you can now say
selector.clearValue instead of
browser.clearElement and then pass the selector that you want to use.
addValue replaced with
Similarly, we no longer have
addValue from version 4. It is now in version 5 referred to as
moveToObject replaced with
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.
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.