Login to TradingView using Python and Selenium



  • I am new in Selenium and i don't understand how how to find the way to add my email and password to trading view. I have tried the example shown to connect to facebook and worked fine, but in TradingView it seems like the login page is not clearly described in the source of the page.

    Here is the login page: https://www.tradingview.com/#login

    and i tried that code that works fine for facebook:

    browser.get("https://www.tradingview.com/#login")
    browser.find_element_by_id("email").send_keys("MYEMAIL")
    browser.find_element_by_id("pass").send_keys("MYPASSWORD")
    browser.find_element_by_id("loginbutton").click()
    

    i would really appreciate help thanks



  • The Trading View website has no login on that url. You could try to visit https://www.tradingview.com/#signin or click the Sign In button first.

    browser.get("https://www.tradingview.com/#signin")
    browser.find_element_by_name("username").send_keys("MYEMAIL")
    browser.find_element_by_name("password").send_keys("MYPASSWORD")
    browser.find_element_by_xpath("//button[@type='submit']").click()
    

    Also you cannot just blindly re-use what works on one site on another one and expect it to behave the same. You need to inspect the HTML of the site and look at the elements. In this case there are no elements with ID's email, pass and or loginbutton. I rewrote them as I think they might work.

    Have a look at: https://www.toolsqa.com/selenium-webdriver/inspect-elements-with-chrome-developer-tools/



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2