I am trying to implement a wait by checking if the page title contains 'Page 1' like this
try:
WebDriverWait(driver, 10).until(EC.title_contains("Page 1"))
except TimeoutException as e:
return
How can I modify this so it also checks for a page title of 'Page 2', so if either of those page titles show up then it passes?
You can try below code:
try:
WebDriverWait(driver, 10).until(lambda x: 'Page 1' in driver.title or 'Page 2' in driver.title)
except TimeoutException as e:
pass
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With