Whenever I run my code, it keeps returning the error message:
NoSuchElementError: no such element: Unable to locate element
Even though I have set up a wait function, it does not seem to actually wait. The step fails immediately without waiting for the specified time.
In my world.js file, I declare my driver like this:
var driver = buildChromeDriver();
...
var World = function World() {
...
this.driver = driver;
}
One of my steps looks like this:
this.Then(/^xxxxx$/, function () {
this.driver.wait(function () {
return this.driver.findElement({ xpath: props.woocomerceSelectors.viewCart }).isDisplayed();
}, 4000);});