I use Cucumber/selenium/JavaScript to log into my application page. This works with no problem. After I log in, however, the system won't wait for the control to be visible and reports that it can't find it.
If I do the same exercise using only JavaScript and selenium, the control is visible after 4 seconds (I use "'''driver.sleep(4000)'''" and selenium finds it without problem.
I'm fairly new to Cucumber. How do I dynamically detect control existence without failing?
The attached code sample is what's failing in Cucumber but succeeding in selenium after a 4 second wait.
When('I click Login', async function () {
loginButton = await driver.findElement(By.xpath(".//* [@id='loginButton']"));
loginButton.click();
});
I expected an asynchronous function with a 9 second timeout defined in world.js (this.setDefaultTimeout(90 * 1000);) to wait for controls to appear.
This straightforward assumption fails. What am I missing or doing wrong?