Currently, I am in the process of writing tests for my website using WebdriverIO with Mocha and Chai. However, I encountered an issue where my element is not rendered before attempting to interact with it.
it('select application', function(done) {
client
.click('.disciplinetext > table:nth-child(7) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(3) > button:nth-child(1)')
// more actions
The element should ideally be implicitly waited for by the .click()
command until it is fully loaded on the page. Unfortunately, this seems to be missing from the functionality.
To resolve this problem, adding a line such as:
.waitFor('.disciplinetext > table:nth-child(7) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(3) > button:nth-child(1)',1000)
before interacting with elements like .setValue()
, .click()
, or .getText()
appears to solve the issue temporarily. Nevertheless, having to include a waitFor
command before every action is not ideal.
Is there a way to either set a command that waits for the entire page to load, or configure a setting that automatically waits before accessing any elements through WebdriverIO?