Home > other >  Selenium Python How to check if class AND style match for Element?
Selenium Python How to check if class AND style match for Element?

Time:12-13

I have this progress Bar element, as soon as I upload an image the width of the element changes from 0% to 100%

This is the Inspect Element

now what I want to do is wait until that element is 100% before doing the next steps in my Python Selenium script. Mainly I want to know if I can just do something like this:

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='bar'] [ADD HERE SOMETHING THAT'S LIKE: STYLE WIDTH==100%")))

Anything possible to do so?

CodePudding user response:

This should work:

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='bar'][contains(@style,'width: 100%')]
  • Related