dvalbuena1 / visa_rescheduler_aws

US VISA (ais.usvisa-info.com) appointment re-scheduler - Colombian adaptation - AWS Lambda
24 stars 10 forks source link

Element not interactable errors when trying to click the down-arrow bounce button #20

Open kchaya1 opened 1 year ago

kchaya1 commented 1 year ago

The way the code works rn relies on the code clicking this button:

Screenshot 2023-11-25 at 12 12 04 AM

right here: https://github.com/dvalbuena1/visa_rescheduler_aws/blob/main/visa.py#L112

However, I got some errors saying that this element is not interactable. I modified my lambda to take a screenshot of the current webpage and store it in s3 whenever this happens. This is what that screenshot looks like: 5843e32d-37dc-4538-93a6-3fc0400fe8d5

SO basically, there are times when that down-arrow bounce doesn't appear on the website.

I also logged out all the CSS elements on the page whenever this happens. For the down arrow bounce, this is what my logs say:

INFO:log_css_elements_upload_screenshot_s3 - Element tag: a, class: down-arrow bounce, is_visible:False, is_enabled:True, interactable: False

So basically it is "enabled" but not "visible", and thus it cant be interacted with. Anyone else see this issue? So sometimes, the down-arrow bounce is not there. I think we will need some special logic to check if its not interactable, proceed with the rest of the steps anyway.

dvalbuena1 commented 9 months ago

Sorry for the late reply,

What you could do is to add something like

try:
     a = self.driver.find_element(By.XPATH, '//a[@class="down-arrow bounce"]')
     a.click()
     tm.sleep(STEP_TIME)
except NoSuchElementException:
     # No arrow

In this way, if there is no arrow you will not get any error, it is a way just to skip that step