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:


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.


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/

| improve this answer | |
  • Hi Niels, thank you so much. This is really nice of you. very clear explanation and working great. i will read your link thank you. In face i understand better the way to use selenium. what is confused to me is how you found this class name in the huge amount of information that the source of the page is showing: @class='tv-header__link tv-header__link--signin js-header__signin' i need fo figure out how to find the verious pop up windows i need to close automatically – PhilippeGe Nov 25 '19 at 6:18

Actually this question shows the lack of basic research from your side.

Before learning a tool and technology, we should have a clear understanding of why we need it in the first place.

In your case, you are trying to automate the login process for the tradingview webpage.

So first understand what are the manual steps involved and then automate it:

  1. Goto https://www.tradingview.com/


  2. Click the sign-in icon for the sign in overlay screen to be displayed:

So we find the sign-in icon using xpath and then click it

browser.find_element_by_xpath("//*[@class='tv-header__link tv-header__link--signin js-header__signin']").click()
  1. Now we have clicked the sign-in icon but have to wait for the overlay to open:

you can wait using time.sleep or explicit wait for the element to be present

import time 


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

driver = webdriver.Firefox()
    element = WebDriverWait(driver, 10).until(
  1. Provide the login details

    browser.find_element_by_name("username").send_keys("youremail") browser.find_element_by_name("password").send_keys("yourpassword")

  2. Click submit


| improve this answer | |
  • thanks for your help PDHide, no this is not really a lack of basic research. i understood the basics of python and selenium but i have no knowledges on Javascript to understand where to find the right information to connect to. i read the source of the page of tradingview for an hour and didnt get any idea where to find the login page as well as to access the pop up that shows up and want to clear out. if you have any pointer on learning that i would really appreciate. – PhilippeGe Nov 25 '19 at 6:35
  • Why are you concerned with JavaScript ? We are just looking into HTML Dom . You can use protractor of you want to avoid using explicit wait in angular Js applications – PDHide Nov 25 '19 at 8:09
  • Yes. I want to read alerts from tradingview in fact, but even if thanks to Niels, in his last answer i used the Chrome developper to find the right classes. Unfortunately, it seems that the alert are not considered as alert by selenium . i can find the xpath of that: <div class="tv-alert-notification-dialog__subtitle">BTCUSDT, 1 Crossing Example of alertcondition (close)</div> but cannot read the content. this command shows that the class exists browser.find_elements_by_xpath("//*[@class='tv-alert-notification-dialog__subtitle']") but i cannot read the text in that – PhilippeGe Nov 25 '19 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.