I am trying to access and login to the following webpage using Selenium in Python:
'http://games.espn.com/ffl/leagueoffice?leagueId=579054&seasonId=2018'
When the page is accessed a pop up window appears asking for the user's credentials. The below code is what I have so far.
import time
from selenium import webdriver
user = 'test_user'
pw = '*********'
url = 'http://games.espn.com/ffl/leagueoffice?leagueId=579054&seasonId=2018'
driver = webdriver.Chrome("C:\\Users\\abc\\Downloads\\chromedriver\\chromedriver.exe")
driver.get(url)
obj = driver.switch_to_alert
time.sleep(5)
obj.find_element_by_name('email').send_keys(user)
obj.find_element_by_name('password').send_keys(pw)
When I run it I receive this error:
AttributeError: 'function' object has no attribute 'find_element_by_name'
Based on other stackoverflow threads I thought I was approaching this correctly. Could anyone help me on this?
driver.switch_to_alert()?