I am currently testing all elements on my website. The typical flow is:
- Load webpage
- Find element
- Click element
My setup uses switch statements to pick the correct browser.driver.findElement to find the desired element.
Example code:
switch (element_name) {
case "red button":
return browser.driver.findElement(By.id('redButton'));
break;
This return value is then used with click() to click on the element.....
My issue is that it seems that the elements can't consistently be found after the web page loads. I will inconsistently get errors that reference unable to find element or element is not visible. So I am looking for a way to keep checking if the element is loaded, then attempt to click it. I have seen the examples using EC.visibilityOf(), but it looks like I can't use browser.driver.findElement with that.
I have done a lot of research and testing of different solutions, but can't seem to get anything to work for me. Any help or guidance would be appreciated.
Aucun commentaire:
Enregistrer un commentaire