2

Using python 3 and chrome driver. I'm trying to click on my desired element searching for the text displayed on this page . For example, in case of "BEBES" I'm using:

WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[contains(text(), "BEBES")]'))).click()

but nothing happens. Just throws the time out exception. What's my error?

Bronco
  • 23
  • 4

2 Answers2

0

Your xPath is not correct. Use this:

WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH,'//span[contains(text(), "Bebes")]'))).click()

Note: upper/lowercase makes difference

img1

and

img2

Andrei Suvorkov
  • 5,559
  • 5
  • 22
  • 48
0

This post suggests using the following as text() returns a node set:

//*[text()[contains(.,'BEBES')]]

XPath contains(text(),'some string') doesn't work when used with node with more than one Text subnode

LoflinA
  • 350
  • 4
  • 19