fgebhart / zeit-on-tolino

Service to auto-upload the ZEIT 🗞 e-paper to your tolino cloud library 📚
MIT License
14 stars 23 forks source link

popup on webreader.mytolino.com lets upload fail #23

Closed superhenne closed 1 year ago

superhenne commented 1 year ago

A popup on the webreader.mytolino prevents the execution of the upload step. Currently, on webreader.mytolino.com there is a popup, an ad for the tolino story days. The upload action fails, because the button "my books" is hidden by that popup. Even hiding the popup in an interactive login ("do not show anymore") does not help.

this is from the log, full log attached:

[31](https://github.com/superhenne/zeit-on-tolino/actions/runs/3401256607/jobs/5656232876#step:6:32)
selenium.common.exceptions.ElementClickInterceptedException: Message: Element <span class="_abw475 _8gszq5"> is not clickable at point (130,212) because another element <div class="_yskwg2 _1a6uj04"> obscures it

1_Zeit to Tolino Cloud (1).txt

fgebhart commented 1 year ago

Thanks for looking into this issue. I realized the upload was failing, but haven't found the time to look into it.

Looks like you found the root cause of the issue. However, I just double checked the content of the ad, which advertises the tolino story days for 4th and 5th of November. While it could of course be helpful to have an mechanisms in place which ticks such an ad off for upcoming advertisements, I still have some hope that the current ad will be gone by tomorrow.

As I anyway won't have time to implement a fix for this in the next days, I'd suggest to wait and check whether tolino will remove the add in the next days.

superhenne commented 1 year ago

In the mean time i played with the code and put something in to close the ad. It did work in my test, no clue how it does when the ad was not there.

i added this in tolino.py between # wait until logged in and # click on 'my books', maybe you can use it somehow.

    # click popup
    popup_button_css = 'div[data-test-id="dialogButton-0"]'
    WebDriverWait(webdriver, Delay.small).until(EC.presence_of_element_located((By.CSS_SELECTOR, popup_button_css)))
    WebDriverWait(webdriver, Delay.small).until(EC.element_to_be_clickable((By.CSS_SELECTOR, popup_button_css)))
    popup_button = webdriver.find_element(By.CSS_SELECTOR, popup_button_css)
    time.sleep(Delay.small)
    popup_button.click()

btw... need to add that this is my first look into python and github.

fgebhart commented 1 year ago

Thanks for providing the required changes. I added the changes with slight modifications and merged it to main.

Even if the ad should vanish soon, zeit-on-tolino should be more robust for future ads.

See the changes for reference: https://github.com/fgebhart/zeit-on-tolino/pull/24/files#diff-637d7dd7bc9473be12a1e469c06d08f1d2829d003d492ae5b40cffbb610f28e0

Try updating your forked repo to benefit from these changes. Let me know if you still experience any issues.