So, I had posted originally here about an issue with clicking onto 'Next' to continue with logging into my Yahoo account. (Original post: Yahoo sign in with Selenium, missing click)
I had gotten it to work and managed to log in with the code below this past weekend, logging into my account, but today, when I went to show my professor this side project of mine, the login didn't work because my click was not making it past the password submission. Instead of making it past the 'Next' to submit the password and complete the login, it clicks on the advertisement, I guess, behind the form box. An image is attached below for example, but here's the code that had worked originally:
def login(self):
# SEND EMAIL KEYS
WebDriverWait(self.driver, 3).until(EC.element_to_be_clickable(\
(By.XPATH, "//input[@class='phone-no ' and @id='login-username']"))).send_keys(email)
# CLICK NEXT
self.driver.find_element_by_xpath("//input[@id='login-signin']").submit()
self.driver.implicitly_wait(5)
# SEND PASSWORD KEYS
self.driver.implicitly_wait(5)
WebDriverWait(self.driver, 5).until(EC.element_to_be_clickable(\
(By.XPATH, '//*[@id="login-passwd"]'))).send_keys(password)
# CLICK NEXT
WebDriverWait(self.driver, 20).until(EC.element_to_be_clickable(\
(By.CSS_SELECTOR, '[class=button-container]'))).click()
Instead, it clicks on the advertisement and not the button on the form box. This ends up opening a completely different tab related to the advertisement, be it Norton, or FreePass, etc...
I tried during his office hours to fix it, but none of it worked. I tried NAME, XPATH, CLASS, ID, etc... I might be calling them wrong I forget which is which, but I was going back between the documentation trying different selectors, and yes, using them correctly. I tried implicitly_wait instead of using the ExpectedConditions class, as well, but none of it worked.
I did however try the below code instead:
def login(self):
# SEND EMAIL KEYS
WebDriverWait(self.driver, 3).until(EC.element_to_be_clickable(\
(By.XPATH, "//input[@class='phone-no ' and @id='login-username']"))).send_keys(email)
# CLICK NEXT
self.driver.find_element_by_xpath("//input[@id='login-signin']").submit()
self.driver.implicitly_wait(5)
# SEND PASSWORD KEYS
self.driver.implicitly_wait(5)
WebDriverWait(self.driver, 5).until(EC.element_to_be_clickable(\
(By.XPATH, '//*[@id="login-passwd"]'))).send_keys(password)
# CLICK NEXT
self.driver.implicitly_wait(20)
try:
element = WebDriverWait(self.driver, 20).until(EC.element_to_be_clickable(\
(By.ID, 'login-signin')))
finally:
self.driver.quit()
element.click()
And then I end up getting this weird exception: "HTTPConnectionPool(host='127.0.0.1', port=36561): Max retries exceeded with url: /session/13fbff99fe85a470c34475fd6186b0cb/element/23be378e-9643-4f16-8c74-7647e9d80ff8/click (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',))"
I have no idea what's going on. My original project was working awesomely at home, going through all the clicks and submissions and scraping various popups, but now it doesn't work. I tired running it on my phone's hotspot which is better than my school's campuswide wifi, and my home wifi too, but it still doesn't work and clicks on the advertisement instead.
I also just tried the below snippet instead of wait element to be clickable:
element = WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located(\
(By.ID, 'login-signin')))
This did not work either, the browser opens and closes and gives me the same connection error I've described.
Could this possibly have to do with my internet connection?
Observe that my password keys get sent correctly. 
All else is equal in terms of the updated driver for chromedriver running on linux. With the penultimate version of ubuntu to date. Please help, thank you. My python3 is up-to-date for the latest version that linux supports without turning my computer to mash potatoes.
