I am trying to write a login function. When I try to login into my yahoo account, I send the correct keys for my email address, which works, but then when I click "next" it 'misses' the click and instead clicks the banner which opens up some sort of advertisement be it travel related or Norton anti-security, or something. I've been working on this issue intermittently throughout the past week surfing and digging through forums before finally making my first post.
I am aware of the different ways of element selectors via css, id, class name, xpath, etc... I tried sleep(), implicit_wait(), things along those lines. I also tried something with wait until clickable with the expected conditions module from selenium.webdriver.
I've attached an image of what I have so far. My python version is up-to-date as are my selenium and chrome driver installations. I saw a similar post already up, but the OP didn't seem to be encountering my issue. (how to click on the yahoo sign in link using selenium web driver?)
I tried this as well, and it opens the advertisement; in my executions, Norton seems to be the most frequently appearing advertisement. (login to Yahoo using Python Selenium)
I've looked at the API documentation, but there doesn't seem to be any clear direction on what I could do. I've attached screenshots of what happens on the running of the script as well as the code I have.
I got it to work for some runs where I was able to go to the next form to send my password keys, but it happened randomly and inexplicably.
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from login import password, email
from time import sleep
class yahoo():
def __init__(self):
# INITIALIZE CHROME WEBDRIVER
self.driver = webdriver.Chrome()
self.driver.maximize_window()
def login(self):
# OPEN BROWSER TO LOGIN PAGE AND MAXIMIZE
self.driver.get("https://login.yahoo.com/config/login?.\
src=fpctx&.intl=us&.lang=en-US&.done=https://www.yahoo.com")
# LOGIN ACTIONS
{# 1. send email address and click next
self.driver.find_element_by_id('login-username').send_keys(email)
element = WebDriverWait(self.driver, 10).until(\
EC.presence_of_element_located((By.ID, "login-signin")))
element.click()
# 2. send password and click sign in
self.driver.find_element_by_xpath('//*[@id="login-passwd"]').send_keys(password)
self.driver.find_element_by_id('login-signin').click()}`enter code here
x = yfscreeners()
x.login()
Any help is well appreciated.

