0 votes
1 view
in Devops and Agile by (23.1k points)

I'm trying to write scripts to download relevant data from my Wells Fargo account, and using Selenium within a python script seems like a good potential solution. However, when I try to log in, I get redirected to a different login screen, which keeps redirecting to itself each time I try to log in again. How do I get past this infinite redirect?

The simplest way to reproduce this is to run this script to open a selenium Chrome browser:

import selenium

browser = selenium.webdriver.Chrome()

browser.get('https://www.google.com/')

Then manually log in. On a normal browser, this works fine. In the selenium browser, I get the redirect page.

1 Answer

0 votes
by (58.7k points)

Try this code:

from selenium.webdriver import Chrome

browser = Chrome()

browser.get('https://google.com')

#GET user element and POST username to element

user = browser.find_element_by_id('userid'

)

user.

send_keys('USERNAME')

#GET user element and POST password to element

passwd = browser.find_element_by_id('password')

passwd.send_keys('PASSWORD')

passwd.submit()

You should be logged in and redirected to account page. Please tell me how it works out for you.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...