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

Login Failure #6

Open
fj7778 opened this issue Feb 7, 2022 · 0 comments
Open

Login Failure #6

fj7778 opened this issue Feb 7, 2022 · 0 comments

Comments

@fj7778
Copy link

fj7778 commented Feb 7, 2022

The existing code for logging in within the downloader works for some courts but not others. Would recommend the following:

  1. adding client code into the authorization file

  2. replacing the following code in scraper_tools.py:

    fill_values =  {'username':auth['user'], 'password':auth['pass']}
    login_form = forms.FormFiller(browser, 'login',fill_values)
    login_form.fill()
    time.sleep(1)
    login_form.submit()
    time.sleep(2)

with:

    try:
        element_username = browser.find_element_by_name("login")
    except:
        element_username = browser.find_element_by_name("loginForm:loginName")
    element_username.send_keys(auth['user'])

    try:
        element_password = browser.find_element_by_name("key")
    except:
        element_password = browser.find_element_by_name("loginForm:password")  
    element_password.send_keys(auth['pass'])

    try:
        element_clientcode = browser.find_element_by_name("clcode")
    except:
        element_clientcode = browser.find_element_by_name("loginForm:clientCode")
    element_clientcode.send_keys(auth['clc'])

    try:
        time.sleep(1)
        browser.find_element_by_name("button1").click()
        time.sleep(2)
    except:
        time.sleep(1)
        browser.find_element_by_name("loginForm:fbtnLogin").click()
        time.sleep(2)

The suggested fix is not guaranteed to always work but it has proven significantly more robust than the existing code.

  1. reworking the checks for "logging.info('Login succesful')". The case for "Login succesful" is often triggered when login is not actually successful. The check for login success should be conducted by testing a URL to see if the response is as expected for a properly logged in session rather than by just looking for ": timeout error." or "Invalid username or password".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant