'Any built-in way for branching waits with OR conditions?
After I click a button on a webpage, one of two things can happen. Normally, I would use a wait until when there's a single event outcome, but is there any built in methodology where I can wait until 1 of two things happens i.e. one of two elements exists?
Solution 1:[1]
you can do it tbh this is in java i dont know about python but this is at least an idea if you have two condition to be met for example input 1 to be present and input 2
I would create two boolean variabels that i will put in them driver.findelements(by....).size()>0;
then i will just add an if so in case not both of them show it will crash or do what ever i want.
Code example:
Boolean AccesViaLogin = driver.findElements(By.id("username_login")).size() > 0;
Boolean AccesViaHomepage = driver.findElements(By.xpath("//button[contains(text(),\"Connexion\")]")).size() > 0;
if (AccesViaLogin == true && AccesViaHomepage == true) {
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Yan |
