ircham
ircham

Reputation: 129

Selenium python: wait and check if xpath not contain string

I have a selenium code to open an url and the result shown in image below:

enter image description here

I want to wait until the string "In Progress" is missing to continue the code execution. I have used the code:

while(1):
  if not wait.until(EC.text_to_be_present_in_element((By.XPATH, '/html/body/div[1]/div[2]/div[3]/table/tbody/tr[1]/td[2]/span'),'In Progress')):
    print('Completed')
    break

but when the string "In Progress" is already missing, i get selenium.common.exceptions.TimeOutException. Any clue?

Upvotes: 0

Views: 86

Answers (1)

PDHide
PDHide

Reputation: 19939

WebDriverWait(driver,10).until_not(EC.text_to_be_present_in_element((By.XPATH, '//div'), 'In Progress'))

use until_not

Upvotes: 2

Related Questions