1

I'm trying to click a the element with text as I don't have the telephone on this website.

So I find the element with inspect. here is the element in html:

<span class="toggle-link link_has-no-phone" role="button">I&nbsp;don't have a&nbsp;telephone number</span>

In my nonfunctional code i wrote this:

r = driver.find_element_by_xpath("//*[@id='root']/div/div[2]/div/main/div/div/div/form/div[3]/div/div[2]/div/span")
r.click

The button is never clicked and nothing happens i get no error and i can't click it any help would be appreciated.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Saucyflo
  • 13
  • 2

3 Answers3

1

You can use css selector below to get span:

r = driver.find_element_by_css_selector(".link_has-no-phone")
r.click()
Sers
  • 12,047
  • 2
  • 12
  • 31
1
r = driver.find_element_by_xpath("//*[@id='root']/div/div[2]/div/main/div/div/div/form/div[3]/div/div[2]/div/span")
r.click()

You just forgot the parenthesis

0

To click on the element with text as I don't have a telephone number you can use either of the Locator Strategies:

  • css_selector:

    driver.find_element_by_css_selector("span.toggle-link.link_has-no-phone").click()
    
  • xpath:

    driver.find_element_by_xpath("//span[@class='toggle-link link_has-no-phone']").click()
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352