Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 unable to login with selenium
#1
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)

Output:
$ python test1.py Sign In
Quote
#2
Look at browser.page_source  to see if you are logged in.
Quote
#3
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-co...ighlighter
Quote
#4
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)
Quote
#5
ah ok. That time sleep was it.  Big Grin
thanks.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Python-selenium script for automated web-login does not work hectorKJ 2 270 Sep-10-2019, 01:29 PM
Last Post: buran
  Unable to access javaScript generated data with selenium and headless FireFox. pjn4 0 193 Aug-04-2019, 11:10 AM
Last Post: pjn4
  Selenium Parsing (unable to Parse page after loading) oneclick 6 777 Jan-13-2019, 03:10 AM
Last Post: oneclick
  locating element with selenium after login sumandas89 1 1,203 Jan-15-2018, 02:40 PM
Last Post: metulburr
  Unable to select iframe using selenium endejoli 1 893 Jan-11-2018, 05:13 PM
Last Post: j.crater
  unable to load file using python selenium purnima1 4 2,867 Dec-12-2017, 04:04 PM
Last Post: hshivaraj
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 1,022 Nov-03-2017, 08:41 PM
Last Post: metulburr

Forum Jump:


Users browsing this thread: 1 Guest(s)