jakehilborn / debbit

Automate spending requirements for high interest checking accounts / credit cards
https://jakehilborn.github.io/debbit/
MIT License
261 stars 29 forks source link

Amazon issue "Element could not be scrolled into view" #72

Closed shbach closed 2 years ago

shbach commented 2 years ago

I'm having issues running debbit where when it gets to the point it needs to select the card to use, it errors out. Perhaps it is due to the large number of cards I have linked in my Amazon account?

I've tried this on Linux with the latest version of the debbit script and geckodriver and get this error:

v2.1.3-dev Linux Traceback (most recent call last):
  File "/home/shbach/debbit/src/debbit.py", line 294, in web_automation_wrapper
    result = merchant.web_automation(driver, merchant, amount)
  File "/home/shbach/debbit/src/program_files/merchants/amazon_gift_card_reload.py", line 160, in web_automation
    driver.find_element_by_xpath("//span[contains(text(),'Continue')]").find_element_by_xpath('../..').click()
  File "/home/shbach/.local/share/virtualenvs/src-VrT7s6Vy/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/home/shbach/.local/share/virtualenvs/src-VrT7s6Vy/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "/home/shbach/.local/share/virtualenvs/src-VrT7s6Vy/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/shbach/.local/share/virtualenvs/src-VrT7s6Vy/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: Element <span id="pp-me15RH-427" class="a-button a-button-primary a-hidden aok-hidden"> could not be scrolled into view

I also tried this in Windows and got a similar error:

v2.1.2 Windows Traceback (most recent call last):
  File "debbit.py", line 294, in web_automation_wrapper
  File "C:\Users\Steven\Downloads\debbit-v2.1.2-win64\program_files\merchants\amazon_gift_card_reload.py", line 160, in web_automation
    driver.find_element_by_xpath("//span[contains(text(),'Continue')]").find_element_by_xpath('../..').click()
  File "selenium\webdriver\remote\webelement.py", line 80, in click
  File "selenium\webdriver\remote\webelement.py", line 633, in _execute
  File "selenium\webdriver\remote\webdriver.py", line 321, in execute
  File "selenium\webdriver\remote\errorhandler.py", line 242, in check_response
selenium.common.exceptions.ElementNotInteractableException: Message: Element <span id="pp-AS7t00-427" class="a-button a-button-primary a-hidden aok-hidden"> could not be scrolled into view
jakehilborn commented 2 years ago

This is likely due to the large number of cards you have. Can you try updating to Debbit v.2.1.3 and running it again? I've enhanced the failure report email feature so I can take a deeper look into this.

https://github.com/jakehilborn/debbit/releases/tag/v2.1.3

shbach commented 2 years ago

@jakehilborn I updated to the latest version and enabled the send_failures_to_developer option:

v2.1.4-dev Linux Traceback (most recent call last):
  File "/home/shbach/debbit/src/debbit.py", line 294, in web_automation_wrapper
    result = merchant.web_automation(driver, merchant, amount)
  File "/home/shbach/debbit/src/program_files/merchants/amazon_gift_card_reload.py", line 175, in web_automation
    driver.find_element_by_xpath("//span[contains(text(),'Continue')]").find_element_by_xpath('../..').click()
  File "/home/shbach/.local/share/virtualenvs/src-VrT7s6Vy/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 81, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/home/shbach/.local/share/virtualenvs/src-VrT7s6Vy/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 710, in _execute
    return self._parent.execute(command, params)
  File "/home/shbach/.local/share/virtualenvs/src-VrT7s6Vy/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 424, in execute
    self.error_handler.check_response(response)
  File "/home/shbach/.local/share/virtualenvs/src-VrT7s6Vy/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: Element <span id="pp-yitN4P-360" class="a-button a-button-primary a-hidden aok-hidden"> could not be scrolled into view
Stacktrace:
WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:181:5
ElementNotInteractableError@chrome://remote/content/shared/webdriver/Errors.jsm:291:5
webdriverClickElement@chrome://remote/content/marionette/interaction.js:156:11
interaction.clickElement@chrome://remote/content/marionette/interaction.js:125:11
clickElement@chrome://remote/content/marionette/actors/MarionetteCommandsChild.jsm:200:24
receiveMessage@chrome://remote/content/marionette/actors/MarionetteCommandsChild.jsm:91:31
jakehilborn commented 2 years ago

@shbach Can you pull the latest code from the master branch and try again? Let me know if it works or if it's still broken.

shbach commented 2 years ago

It works! :)

jakehilborn commented 2 years ago

@shbach Thanks for testing. I've included this bug fix in the v2.1.4 release.