I'm using Python / Selenium to submit a form then I have the web driver waiting for the next page to load by using an expected condition using class id.
My problem is that there are two pages that can be displayed but they do not share an unique element (that I can find) that is not in the original page. One page has a unique class is of mobile_txt_holder
and the other possible page has a class id of notfoundcopy
. I would like to use a wait that is looking for mobile_txt_holder
OR notfoundcopy
to appear.
Is it possible to combine two expected conditions into one wait?
Basic idea of what I am looking for but obviously won't work:
WebDriverWait(driver, 30).until(EC.presence_of_element_located(
(By.CLASS_NAME, "mobile_txt_holder")))
or .until(EC.presence_of_element_located((By.CLASS_NAME, "notfoundcopy")))
I really just need to program to wait until the next page loads so that I can parse the source.
Sample HTML:
<p class="notfoundcopy">Unfortunately, the number you entered is not in our tracking system.</p>
Apart from clubbing up 2
expected_conditions
throughor
clause, we can easily construct aCSS
to take care of our requirement The followingCSS
will look either for the EC either inmobile_txt_holder
class or innotfoundcopy
class: