coskundeniz / ad_clicker

Google Ads clicker
https://coskundeniz.github.io/ad_clicker/
GNU General Public License v3.0
161 stars 62 forks source link

Chrome crash after first ad click #21

Closed umuttanriverd closed 1 year ago

umuttanriverd commented 1 year ago

Hello!!

First of all, thank you for your effort. Project is amazing.

It's collection the ad links, when it starts after the first website, it's trying to turn back and it's crashing.

M1 Pro - Chrome 113 - Python 3.8.9 - Mac OS X. Also sharing the error log and screenshot.

Best regards.

Screen_Shot_2023-05-16_at_01 55 34

16-05-2023 01:54:52 [ INFO]  68: Starting search for 'Car for sale germany'
16-05-2023 01:54:55 [ INFO]  90: Getting ad links...
16-05-2023 01:55:19 [ INFO] 221: =====
<img width="1175" alt="Screen_Shot_2023-05-16_at_01 55 34" src="https://github.com/coskundeniz/ad_clicker/assets/121172311/f14dc7d5-63ee-4fc5-94bd-2362e2a54c02">
== Found an Ad =======
16-05-2023 01:55:19 [ INFO] 221: ======= Found an Ad =======
16-05-2023 01:55:19 [ INFO]  91: Found 1 ads
16-05-2023 01:55:19 [ INFO] 113: Clicking to [Mein Auto verkaufen - Beste Angebote für Autokauf](https://www.auto-eggert.com/fahrzeug/inzahlungnahme-rechner/)...
Traceback (most recent call last):
  File "ad_clicker.py", line 98, in <module>
    main()
  File "ad_clicker.py", line 92, in main
    search_controller.click_ads(ads)
  File "/Users/rabadon/Developer/lab/ad_clicker/search_controller.py", line 130, in click_ads
    self._driver.execute_script("arguments[0].scrollIntoView(true);", ad_link_element)
  File "/Users/rabadon/Developer/lab/ad_clicker/env/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 492, in execute_script
    return self.execute(command, {
  File "/Users/rabadon/Developer/lab/ad_clicker/env/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
  File "/Users/rabadon/Developer/lab/ad_clicker/env/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: stale element not found
  (Session info: chrome=113.0.5672.92```
coskundeniz commented 1 year ago

It seems that second ad found has changed between opening the first ad and returning back, so it can not reference the second ad while trying to scroll it into view. Is it happening once or always? Maybe it is an issue on mac. I don't have a Mac but maybe I can add an exception to ignore it.

umuttanriverd commented 1 year ago

Hey coskundeniz,

When I copying the log I removed few ads manually because discord has character limitation. That's why log loooks weird. Please check the screenshot for original log. Yes probably it's about mac os x, but right now I can not use it if you can fix this bug would be great.

Thank you for your support mate.

coskundeniz commented 1 year ago

Can you try with the latest version?

umuttanriverd commented 1 year ago

Hey @coskundeniz

Thank you for your quick update. Now is not crashing but there are 4 ads. It's just clicking the first one then shutting down chrome (but there is not crash log this time)

coskundeniz commented 1 year ago

That means all remaining ads are stale/changed, so it passes them. Chrome on Mac can have a different behavior for updating ads. Maybe you can try with a Linux distribution on a virtual machine. Thanks.

umuttanriverd commented 1 year ago

Hi @coskundeniz, I installed your project on raspberry pi but I get an error like this. google-chrome is not included in the package, how should I install it?

Screen_Shot_2023-05-22_at_03 07 11

coskundeniz commented 1 year ago

You should install chrome if it is not installed on your system.

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list apt -y update apt install -y google-chrome-stable