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>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…