-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Handle the special case of two (or more) CF CAPTCHAs on the same page at the same time
This will probably never happen in a real-world situation, but it did happen on a test site (https://nopecha.com/captcha/turnstile), where two CF CAPTCHAs appeared on the same page at the same time.

UC Mode should have a way to click on both. Previously, (before CF moved CAPTCHAs into Shadow-DOM), UC Mode could select iframes directly, but now we need to select a parent element that isn't in Shadow-DOM. Something like this:

The existing (but still relatively new) uc_gui_click_captcha()
methods could be modified to handle choosing between multiple CAPTCHAs (although as mentioned earlier, this is not likely to be seen in a real-world scenario, but it could be useful for testing).
Once complete, this script should work:
from seleniumbase import SB
with SB(uc=True, test=True) as sb:
sb.uc_open_with_reconnect("nopecha.com/demo/turnstile", 3.2)
sb.uc_gui_click_captcha("#example-container0")
sb.uc_gui_click_captcha("#example-container5")
sb.sleep(3)
That means that SeleniumBase/examples/raw_nopecha.py will need to be updated for the UC Mode changes.
If there's only one CAPTCHA on a page (which covers 99.99% of CAPTCHA pages), then sb.uc_gui_click_captcha()
will still work as before. (No changes to that algorithm for the one-CAPTCHA scenario are expected.)