Advertisement
Guest User

Python Signin for TradingView with Seleneium & ChromeDriver

a guest
Feb 2nd, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.56 KB | None | 0 0
  1. import pandas as pd
  2. from selenium import webdriver
  3. from selenium.webdriver.chrome.options import Options
  4. from selenium.webdriver.common.keys import Keys
  5. from selenium.webdriver.common.by import By
  6. from selenium.webdriver.support.ui import WebDriverWait
  7. from selenium.webdriver.support import expected_conditions as EC
  8. from selenium.webdriver.common.action_chains import ActionChains
  9. from selenium.webdriver.support.ui import Select
  10. import time
  11. from getpass import getpass
  12.  
  13. options = Options()
  14. options.add_experimental_option("prefs", {
  15.   "download.default_directory": r"D:\python\officepytho",
  16.   "download.prompt_for_download": False,
  17.   "download.directory_upgrade": True,
  18.   "safebrowsing.enabled": True
  19. })
  20.  
  21. while True:
  22.     print("process started")
  23.     #driver = webdriver.Chrome(chrome_options=chrome_options)
  24.     driver = webdriver.Chrome(executable_path = r"D:\python\officepython\chromedriver.exe",chrome_options=options)
  25.     driver.maximize_window()
  26.     wait = WebDriverWait(driver, 10)
  27.     driver.get("https://www.tradingview.com/")
  28.     time.sleep(2)
  29.     signLine = driver.find_element_by_xpath("//*[@class='tv-header__link tv-header__link--signin js-header__signin']")
  30.     signLine.click()
  31.     time.sleep(2)
  32.     username = driver.find_element_by_name("username")
  33.     password = driver.find_element_by_name("password")
  34.     username.send_keys("Your username here")
  35.     username.send_keys(Keys.TAB)
  36.     time.sleep(.2)
  37.     password.send_keys("Your password here")
  38.     time.sleep(.2)
  39.     password.send_keys(Keys.ENTER)
  40.  
  41.  
  42.     input("wait for any key to press")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement