unable to login with selenium - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: unable to login with selenium (/thread-1049.html) |
unable to login with selenium - metulburr - Nov-29-2016 im trying to use selenium to login to a site. However when i attempt to login, i dont think i am logging in as the browser.title still retains "Sign In" when if it is logged in should be "Dashboard" from selenium import webdriver import time import os # 'https://chromedriver.storage.googleapis.com/index.html?path=2.25/' chromedriver = "/home/metulburr/Downloads/chromedriver" os.environ["webdriver.chrome.driver"] = chromedriver browser = webdriver.Chrome(chromedriver) browser.get("https://dg.coupons.com/signin/") time.sleep(10) username = browser.find_element_by_id("email") password = browser.find_element_by_id("password") username.send_keys("USER_EMAIL") password.send_keys("USER_PASSWORD") login_attempt = browser.find_element_by_xpath("//*[@type='submit']") login_attempt.submit() print(browser.title)
RE: unable to login with selenium - snippsat - Nov-29-2016 Look at browser.page_source to see if you are logged in. RE: unable to login with selenium - metulburr - Nov-29-2016 it doesnt appear to me to be logged in. codepad: http://codepad.org/Wse8xDuY codepad it due to other reasons: http://python-forum.io/Thread-html-in-codepad-crashes-syntaxhighlighter RE: unable to login with selenium - snippsat - Nov-30-2016 Set sleep before page_source so you are sure it have load in. Then find something in source that are there only when logged in and compare. time.sleep(6) print(browser.page_source) RE: unable to login with selenium - metulburr - Nov-30-2016 ah ok. That time sleep was it. thanks. |