yahooquery icon indicating copy to clipboard operation
yahooquery copied to clipboard

Ticker login fails with current version of selenium webdriver + fix

Open elteck opened this issue 3 years ago • 0 comments

Describe the bug Ticker login fails with current version of selenium webdriver: "find_element_by_id" is not a member of webDriver (depricated?)

To Reproduce from yahooquery import Ticker

data = Ticker('AAPL', username=', password=, retry=1)

Observe the error from selenium at line 56 for login.py that "find_elemnet_by_id" is not a member anymore.

The solution is simple. Change these lines in yahooquery/login.py, class member yahoo_login:

Line 56 from: self.driver.find_element_by_id("login-username").send_keys(self.username) to: self.driver.find_element(By.ID, "login-username").send_keys(self.username)

Line 57 from: self.driver.find_element_by_xpath("//input[@id='login-signin']").click() to: self.driver.find_element(By.XPATH, "//input[@id='login-signin']").click()

Line 62: from: self.driver.find_element_by_xpath("//button[@id='login-signin']").click() to: self.driver.find_element(By.XPATH, "//button[@id='login-signin']").click()

Also at line 33, argument "chrome_options" is depricated (only a warning), now it is called "options". But that is currently a warning.

With those three changes, everything works as expected!

Expected behavior No error message.

Desktop (please complete the following information):

  • OS: redhat Linux 9
  • chrome Version 103.0.5060.53 (Official Build) (64-bit)

elteck avatar Jun 26 '22 21:06 elteck