Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues logging in - USPS Website Change? #15

Open
nshores opened this issue Apr 20, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@nshores
Copy link
Contributor

commented Apr 20, 2018

I noted today that Selenium and PhantomJS or Chrome are failing to login to the website and generate a auth cookie. I am inveatgating now. Example code to show bug.

from selenium import webdriver
from selenium.common.exceptions import TimeoutException, WebDriverException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

HTML_PARSER = 'html.parser'
BASE_URL = 'https://reg.usps.com'
MY_USPS_URL = BASE_URL + '/login?app=MyUSPS'
AUTHENTICATE_URL = BASE_URL + '/entreg/json/AuthenticateAction'
LOGIN_URL = BASE_URL + '/entreg/LoginAction_input?app=Phoenix&appURL=https://www.usps.com/'
DASHBOARD_URL = 'https://informeddelivery.usps.com/box/pages/secure/DashboardAction_input.action'
INFORMED_DELIVERY_IMAGE_URL = 'https://informeddelivery.usps.com/box/pages/secure/'
PROFILE_URL = 'https://store.usps.com/store/myaccount/profile.jsp'
WELCOME_TITLE = 'Welcome | USPS'
LOGIN_TIMEOUT = 10
COOKIE_PATH = './usps_cookies.pickle'
CACHE_PATH = './usps_cache'
ATTRIBUTION = 'Information provided by www.usps.com'

newdriver = webdriver.PhantomJS()
newdriver.get(LOGIN_URL)


username = newdriver.find_element_by_name('username')
username.send_keys('myusername')
password = newdriver.find_element_by_name('password')
password.send_keys('mypassword')
newdriver.find_element_by_id('btn-submit').click()

Output shows the title of the page not changing, hence a failed login..


In [11]: newdriver.title
Out[11]: 'USPS.com® - Sign In'

@nshores

This comment has been minimized.

Copy link
Contributor Author

commented Apr 21, 2018

An update to this. I have a working login again after switching to Firefox headless and Selenium 3.6. I will be putting out a pull request shortly to give an idea of how to fix this.

@brianjking

This comment has been minimized.

Copy link

commented Jul 12, 2018

@nshores Now that your PR was merged any help on getting this working on my RaspberryPi Hassbian installation? Thanks!

@raman325

This comment has been minimized.

Copy link

commented Feb 19, 2019

I am running into the same issue as described above using Chromedriver

In doing some testing with the above code posted by @nshores , I noticed that when getting the text of username or password after the send_keys commands are called, the value returned is an empty string. Shouldn't I be able to retrieve the username/password values I just sent?

@raman325

This comment has been minimized.

Copy link

commented Feb 19, 2019

Also is it possible to get PR #16 pushed into PyPI? Looks like the latest version of your module as published there doesn't support Firefox

@nshores

This comment has been minimized.

Copy link
Contributor Author

commented Feb 19, 2019

@raman325 This library isn't working anymore due to changes with authentication (Bot detection) on the MyUSPS site.

@raman325

This comment has been minimized.

Copy link

commented Feb 19, 2019

Got it, thanks for the update!

@nshores

This comment has been minimized.

Copy link
Contributor Author

commented Apr 8, 2019

Got it, thanks for the update!

Actually, based on an update to the recent selenium version (3.14) or the USPS website, this is now suddenly working again!

@hanxubrian

This comment has been minimized.

Copy link

commented May 9, 2019

Got it, thanks for the update!

Actually, based on an update to the recent selenium version (3.14) or the USPS website, this is now suddenly working again!

sorry I am new selenium developer can you show me what you have done ?
Will you help me ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.