Search code examples
pythonseleniumweb-scrapingtrading

Cannot Click Element with Selenium - element is either "not interactable" or "unable to locate"


I am having a very difficult time clicking on the "Sign In" element at www.tradingview.com. I've inserted an implicitly_wait and have tried finding the element by xPath and class name. Regardless of what I try, I either get element not interactable or unable to locate element.

from selenium import webdriver

def sign_in():
    driver = webdriver.Chrome()
    driver.get('https://www.tradingview.com/')
    driver.implicitly_wait(10)
    driver.find_element_by_class_name('tv-header__profile-menu js-device-menu-btn').click()

sign_in()

Solution

  • Seems that you are trying to find the wrong element...

    Try this one:

    driver.find_element_by_xpath("//a[text()='Sign In']/ancestor::span").click()