jakehilborn / debbit

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

tds telecom autopay troubleshooting #23

Open dave-sWpR46Ae opened 4 years ago

dave-sWpR46Ae commented 4 years ago

I'm having a hard time automating the following button. Wish I could copy/paste this easier, but not sure how to do so after inspection.

https://i.imgur.com/jyulDwn.png

As you can see, there are 3 almost identical buttons. The first two are hidden/don't work. I want to click the third one. I can't search by ID because button-1196 changes from login to login.

driver.find_element_by_xpath("//span[contains(text(), 'Submit Payment')]").click() works, but it finds the first link and not the third link. If I could get the button ID of the first button and add 2, that should work, but I'm at a bit of a loss trying to actually get this working.

jakehilborn commented 4 years ago

The best way I can help debug this is using debbit's built in failure recording since it will show a screenshot, a copy of the webpage HTML, and the lines of code executed in the merchant automation.

Whatever you currently have working, could you run it via debbit? Make sure you have pulled the latest code from the master branch. In the failures folder there will be files with timestamps for names. Each timestamp will have 4 pieces now; .txt, .png, .html, and a folder ending in coverage. Upload them to this GitHub Issue and I'll help.

dave-sWpR46Ae commented 4 years ago

I went ahead and did so, removing the hardcoded stuff and hopefully all the identifying information.

failures.zip

The key is here though:

v1.0.2-dev Traceback (most recent call last): File "debbit.py", line 292, in web_automation_wrapper result = merchant.web_automation(driver, merchant, amount) File "C:\Run\debbit\Testing\debbit-master\src\program_files\merchants\tds_bill_pay.py", line 78, in web_automation driver.find_element_by_xpath("//span[contains(text(), 'Submit Payment')]").click() #submit payment1 File "C:\Users\John\.virtualenvs\src-cm535gzh\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click self._execute(Command.CLICK_ELEMENT) File "C:\Users\John\.virtualenvs\src-cm535gzh\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute return self._parent.execute(command, params) File "C:\Users\John\.virtualenvs\src-cm535gzh\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\John\.virtualenvs\src-cm535gzh\lib\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="button-1194-btnInnerEl" class="x-btn-inner x-btn-inner-default-medium"> could not be scrolled into view

I want to click button-1196, not button 1194, as 1194 and 1195 are unclickable. The only difference between them is the ID (which I can't hardcode) and the style. Here's the 3 links in the website that are giving me issues:

<a class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-medium" style="min-width: 80px; margin-right: 5px; margin-left: 5px; display: none;" hidefocus="on" unselectable="on" role="button" aria-hidden="true" aria-disabled="false" id="button-1194" tabindex="0" data-componentid="button-1194"><span id="button-1194-btnWrap" data-ref="btnWrap" role="presentation" unselectable="on" style="" class="x-btn-wrap x-btn-wrap-default-medium "><span id="button-1194-btnEl" data-ref="btnEl" role="presentation" unselectable="on" style="" class="x-btn-button x-btn-button-default-medium x-btn-text    x-btn-button-center "><span id="button-1194-btnIconEl" data-ref="btnIconEl" role="presentation" unselectable="on" class="x-btn-icon-el x-btn-icon-el-default-medium  " style=""></span><span id="button-1194-btnInnerEl" data-ref="btnInnerEl" unselectable="on" class="x-btn-inner x-btn-inner-default-medium" style="">Submit Payment</span></span></span></a>

<a class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-medium" style="min-width: 80px; margin-right: 5px; margin-left: 5px; display: none;" hidefocus="on" unselectable="on" role="button" aria-hidden="true" aria-disabled="false" id="button-1195" tabindex="0" data-componentid="button-1195"><span id="button-1195-btnWrap" data-ref="btnWrap" role="presentation" unselectable="on" style="" class="x-btn-wrap x-btn-wrap-default-medium "><span id="button-1195-btnEl" data-ref="btnEl" role="presentation" unselectable="on" style="" class="x-btn-button x-btn-button-default-medium x-btn-text    x-btn-button-center "><span id="button-1195-btnIconEl" data-ref="btnIconEl" role="presentation" unselectable="on" class="x-btn-icon-el x-btn-icon-el-default-medium  " style=""></span><span id="button-1195-btnInnerEl" data-ref="btnInnerEl" unselectable="on" class="x-btn-inner x-btn-inner-default-medium">Submit Payment</span></span></span></a>

<a class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-medium" style="min-width: 80px; margin: 0px; right: auto; top: 0px; left: 764px;" hidefocus="on" unselectable="on" role="button" aria-hidden="false" aria-disabled="false" id="button-1196" tabindex="0" data-componentid="button-1196"><span id="button-1196-btnWrap" data-ref="btnWrap" role="presentation" unselectable="on" style="" class="x-btn-wrap x-btn-wrap-default-medium "><span id="button-1196-btnEl" data-ref="btnEl" role="presentation" unselectable="on" style="" class="x-btn-button x-btn-button-default-medium x-btn-text    x-btn-button-center "><span id="button-1196-btnIconEl" data-ref="btnIconEl" role="presentation" unselectable="on" class="x-btn-icon-el x-btn-icon-el-default-medium  " style=""></span><span id="button-1196-btnInnerEl" data-ref="btnInnerEl" unselectable="on" class="x-btn-inner x-btn-inner-default-medium">Submit Payment</span></span></span></a>

If I could make this line: driver.find_element_by_xpath("//span[contains(text(), 'Submit Payment')]").click() #submit payment1 click the third box with "submit payment" as text, it would work.