Skip to content

Commit

Permalink
"Yahoo Finance Premium instituting recaptcha #254"
Browse files Browse the repository at this point in the history
Cause of the error might be that in username page contains multiple
names with 'id=login-username' because of it was not able to login and resulting in error and providing us
message:"Unable to login and/or retrieve the appropriate cookies.  This is "
         most likely due to Yahoo Finance instituting recaptcha, which "
         this package does not support."
i changed the method of finding the element to By.XPATH

Signed-off-by: Samir Gorai <[email protected]>
  • Loading branch information
samirgorai committed Dec 31, 2023
1 parent 57a73fc commit 52a4046
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion yahooquery/headless.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def login(self):
try:
self.driver.execute_script("window.open('{}');".format(self.LOGIN_URL))
self.driver.switch_to.window(self.driver.window_handles[-1])
self.driver.find_element(By.ID, "login-username").send_keys(self.username)
#self.driver.find_element(By.ID, "login-username").send_keys(self.username)
self.driver.find_element(By.XPATH, "//input[@id='login-username']").send_keys(self.username)

Check warning on line 43 in yahooquery/headless.py

View check run for this annotation

Codecov / codecov/patch

yahooquery/headless.py#L42-L43

Added lines #L42 - L43 were not covered by tests
self.driver.find_element(By.XPATH, "//input[@id='login-signin']").click()
password_element = WebDriverWait(self.driver, 10).until(
EC.presence_of_element_located((By.ID, "login-passwd"))
Expand Down

0 comments on commit 52a4046

Please sign in to comment.