pythonseleniumselenium-webdriverwebdriverwaitwindow-handles

Using Selenium to Sign Into TradingView.com


I'm trying to use Selenium to sign into TradingView, but it appears as though selenium isn't able to find the password field and send keys, though I can see in real time the cursor click into the password field. I've even tried to send keys using ActionChains. I'm getting the following error:

AttributeError: 'NoneType' object has no attribute 'send_keys'

Below is my code. Any help is greatly appreciated!

from webdriver_manager.chrome import ChromeDriverManager
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

def get_data(self):
    driver = webdriver.Chrome(ChromeDriverManager().install())
    driver.get("https://www.tradingview.com/#signin")
    driver.find_element_by_xpath('//*[@title="Linked In"]').click()
    
    # Switch to new window
    window_after = driver.window_handles[1]
    driver.switch_to.window(window_after)

    # Click into password field, send password
    element = driver.find_elements_by_class_name("form__input--floating")[1].click()
    element.send_keys("TestPassword")

Solution

  • This error message...

    AttributeError: 'NoneType' object has no attribute 'send_keys'
    

    ...implies that your program is trying to invoke click() on a NoneType object.

    click() doesn't returns anything. So element remains NoneType object. Hence you see the error.


    Solution

    To sign into TradingView website through linkedin credentials you have to:

    tradingview_linkedin_login