Pls am trying to use the wait condition to wait for the value of an element to change before clicking it

this is the previous code;

 driver.find_elements_by_xpath('//div[@data-markettypecategory="00000000-0000-0000-da7a-000000580001" and @data-pd="12.01"]')[0].click()

the code above only works when data-pd=12.01, i want to make it wait for data-pd is price (e.g $12.01), it could be any value(e.g 100.00,2.00,50.00 e.t.c), i just want it to be able to wait until the value turns to 12.01 until it clicks

1

There are 1 best solutions below

0
On

first, copy FULL Xpath. NOT normal Xpath.

Full XPath looks like this:

xpath = '/html/body/div[3]/div[2]/div/div[1]/div[1]/h1/a'

You can then get the element's text value and check if it changed.

string = driver.find_elements_by_xpath(xpath).text
print(string)
if string == "12.01":
   click()