infotrex / bulk-upload-to-opensea

BULK UPLOAD NFTs to OPENSEA
276 stars 202 forks source link

Recaptcha is closed by script action before completion #138

Closed sule9na closed 2 years ago

sule9na commented 2 years ago

I've been tracing this issue for a while and I think I know the exact place it's happening now.

On line 393 in the script the captcha box is located and the I'm not a Robot checkbox within it is clicked to start the process. After this selenium must walk back up the Dom so it can then find the next iframe to click the solver/audio buttons.

At this point driver.switch_to.default_content() Is used to make selenium back out of the current iframe. However, this seems to simulate a click on the left side of the browser window, thus clicking outside of the captcha modal and closing it. At this point the script can't find anything it's looking for and bails out.

I've tried fixing this by uncommenting the optional iframe(-1) option, which doesn't work and I also tried driver.switch_to.parent_frame() but it causes the same click on the left side of the browser window.

infotrex commented 2 years ago

try at this driver.switch_to.frame(iframes[-1])

TW88SEO commented 2 years ago

I have the same issue, can you tell me detail to solve this problem?

sule9na commented 2 years ago

try at this driver.switch_to.frame(iframes[-1])

I did try uncommenting your inline commented version before to see if it would work but instead of clicking elsewhere it throws a selenium exception regarding the frame reference.

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\danah\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "C:\Users\danah\Desktop\BulkUpload\upload_captcha3.py", line 402, in main_program_loop
    driver.switch_to.frame(iframes[-1])
  File "C:\Users\danah\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\switch_to.py", line 94, in frame
    self._driver.execute(Command.SWITCH_TO_FRAME, {'id': frame_reference})
  File "C:\Users\danah\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 418, in execute
    self.error_handler.check_response(response)
  File "C:\Users\danah\AppData\Local\Programs\Python\Python310\lib\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: element is not attached to the page document
  (Session info: chrome=99.0.4844.84)
sule9na commented 2 years ago

Finally figured the issue out by printing every step one-by-one to powershell as it ran and realised the issue was occurring inside buster itself and not in this script. You have to disable "Simulate User Interactions" in the buster options otherwise Buster will (for some crazy reason) click outside the captcha box and screw itself over. Once you disable that the interactions are less natural but it doesn't step on it's own toes any more.