Message: element not interactable on accessing a tag python

后端 未结 2 1457
野趣味
野趣味 2021-01-27 01:48

I am trying to access the sign in button on the url as shown in the code below. I have verified the content of the url as well as the href. They are both consistent with what ap

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-27 02:17

    To click on Sign In link Induce WebDriverWait() and element_to_be_clickable() and following css selector.

    WebDriverWait(browser,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"a.main-navigation__navbar>.main-navigation__navbar-text"))).click()
    

    Or following xpath.

    WebDriverWait(browser,5).until(EC.element_to_be_clickable((By.XPATH,"//span[text()='Sign In']"))).click()
    

    You need to import below libraries.

    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    

提交回复
热议问题