You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case you missed #2865, 4.28.0 added a new UC Mode method: uc_gui_handle_cf(), which uses pyautogui to click Cloudflare checkboxes with the keyboard while the driver is disconnected from Chrome. For those of you who might not be familiar with the basics of that, pyautogui keyboard actions only reach the active window on top (in the case of multiple windows). In order for the pyautogui action to be successful, the window with the CAPTCHA must remain on top for the duration of the pyautogui actions. In the case of uc_gui_handle_cf(), that duration is generally less than 2 seconds per call, even if you have a lot of windows open and being controlled at the same time. The "call" includes: Making the current window the active window on top, finding the iframe, switching into the iframe, making the checkbox the active element, and then clicking the checkbox by pressing the spacebar with pyautogui. To prevent that "call" from being disrupted, we need to use thread-locking to prevent other actions from making another window become the active one (for the entire duration of the "call").
Here are some actions that would make another window the active one:
Launching a new browser.
Calling driver.switch_to.window().
Human actions while scripts are running.
Thread-locking can be placed around browser launches that occur via SeleniumBase. It can also be placed around SeleniumBase methods that call driver.switch_to.window() indirectly. There isn't much that can be done about human actions while the scripts are running, or if people are calling driver.switch_to.window() directly from their scripts.
With the extra thread-locking added, we should be able to see a noticeable improvement in the success rate of uc_gui_handle_cf() calls when multiple threads are being used to spin up multiple browsers at the same time. As a side-effect, there may be some slowdowns when multiple threads are trying to change the active window at the same time, because only one thread will be able to perform such an action at one time. This special thread-locking will only take place during UC Mode. For regular mode, there won't be any blockers from scripts performing actions.
The text was updated successfully, but these errors were encountered:
Hey, in my case the latest update doesn't really click on the captcha checkbox on Windows.
Im using SB format. Updates 4.28.0 and 4.28.1 are working properly, however using latest update makes my code stuck on uc_gui_handle_cf method. Even after waiting for 5 and more minutes nothing really happens.
Improve multithreading with UC Mode 4.28.x
In case you missed #2865,
4.28.0
added a new UC Mode method:uc_gui_handle_cf()
, which usespyautogui
to click Cloudflare checkboxes with the keyboard while the driver is disconnected from Chrome. For those of you who might not be familiar with the basics of that,pyautogui
keyboard actions only reach the active window on top (in the case of multiple windows). In order for thepyautogui
action to be successful, the window with the CAPTCHA must remain on top for the duration of thepyautogui
actions. In the case ofuc_gui_handle_cf()
, that duration is generally less than 2 seconds per call, even if you have a lot of windows open and being controlled at the same time. The "call" includes: Making the current window the active window on top, finding the iframe, switching into the iframe, making the checkbox the active element, and then clicking the checkbox by pressing the spacebar withpyautogui
. To prevent that "call" from being disrupted, we need to use thread-locking to prevent other actions from making another window become the active one (for the entire duration of the "call").Here are some actions that would make another window the active one:
driver.switch_to.window()
.Thread-locking can be placed around browser launches that occur via SeleniumBase. It can also be placed around SeleniumBase methods that call
driver.switch_to.window()
indirectly. There isn't much that can be done about human actions while the scripts are running, or if people are callingdriver.switch_to.window()
directly from their scripts.With the extra thread-locking added, we should be able to see a noticeable improvement in the success rate of
uc_gui_handle_cf()
calls when multiple threads are being used to spin up multiple browsers at the same time. As a side-effect, there may be some slowdowns when multiple threads are trying to change the active window at the same time, because only one thread will be able to perform such an action at one time. This special thread-locking will only take place during UC Mode. For regular mode, there won't be any blockers from scripts performing actions.The text was updated successfully, but these errors were encountered: