Skip to content

A fix, an update, and dependencies #3127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/custom_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# Called after self.click(selector), NOT element.click()
WAIT_FOR_RSC_ON_CLICKS = False
# Wait for AngularJS calls to complete after various browser actions.
WAIT_FOR_ANGULARJS = False
WAIT_FOR_ANGULARJS = True
# Skip ALL calls to wait_for_ready_state_complete() and wait_for_angularjs().
SKIP_JS_WAITS = False

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ six==1.16.0
idna==3.8
chardet==5.2.0
charset-normalizer==3.3.2
urllib3>=1.26.19,<2;python_version<"3.10"
urllib3>=1.26.19,<2.3.0;python_version>="3.10"
urllib3>=1.26.20,<2;python_version<"3.10"
urllib3>=1.26.20,<2.3.0;python_version>="3.10"
requests==2.31.0
pynose==1.5.2
sniffio==1.3.1
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.30.5"
__version__ = "4.30.6"
2 changes: 1 addition & 1 deletion seleniumbase/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
# Called after self.click(selector), NOT element.click()
WAIT_FOR_RSC_ON_CLICKS = False
# Wait for AngularJS calls to complete after various browser actions.
WAIT_FOR_ANGULARJS = False
WAIT_FOR_ANGULARJS = True
# Skip all calls to wait_for_ready_state_complete() and wait_for_angularjs().
SKIP_JS_WAITS = False

Expand Down
10 changes: 8 additions & 2 deletions seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,10 @@ def _uc_gui_click_captcha(
reconnect_time = 1 # Make it quick (it already failed)
driver.reconnect(reconnect_time)
caught = False
if driver.is_element_present(".footer .clearfix .ray-id"):
if (
driver.is_element_present(".footer .clearfix .ray-id")
and not driver.is_element_present("#challenge-success-text")
):
blind = True
caught = True
if blind:
Expand Down Expand Up @@ -1209,7 +1212,10 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):

def _uc_gui_handle_captcha(driver, frame="iframe", ctype=None):
_uc_gui_handle_captcha_(driver, frame=frame, ctype=ctype)
if driver.is_element_present(".footer .clearfix .ray-id"):
if (
driver.is_element_present(".footer .clearfix .ray-id")
and not driver.is_element_present("#challenge-success-text")
):
driver.uc_open_with_reconnect(driver.current_url, 3.8)
_uc_gui_handle_captcha_(driver, frame=frame, ctype=ctype)

Expand Down
17 changes: 8 additions & 9 deletions seleniumbase/fixtures/js_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT):
time.sleep(0.03)
return True
if ready_state == "complete":
time.sleep(0.01) # Better be sure everything is done loading
time.sleep(0.002)
return True
else:
now_ms = time.time() * 1000.0
Expand All @@ -61,15 +61,14 @@ def wait_for_angularjs(driver, timeout=settings.LARGE_TIMEOUT, **kwargs):
driver.execute_script("")
except Exception:
pass
if hasattr(driver, "_is_using_uc") and driver._is_using_uc:
# Calling AngularJS waits may make UC Mode detectable.
# Instead, pause for a brief moment, and then return.
time.sleep(0.007)
return
if not settings.WAIT_FOR_ANGULARJS:
if (
(hasattr(driver, "_is_using_uc") and driver._is_using_uc)
or not settings.WAIT_FOR_ANGULARJS
):
wait_for_ready_state_complete(driver)
return
if timeout == settings.MINI_TIMEOUT:
timeout = settings.MINI_TIMEOUT / 4.0
timeout = settings.MINI_TIMEOUT / 6.0
NG_WRAPPER = (
"%(prefix)s"
"var $elm=document.querySelector("
Expand All @@ -96,7 +95,7 @@ def wait_for_angularjs(driver, timeout=settings.LARGE_TIMEOUT, **kwargs):
try:
execute_async_script(driver, script, timeout=timeout)
except Exception:
time.sleep(0.0456)
pass


def convert_to_css_selector(selector, by=By.CSS_SELECTOR):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@
"idna==3.8",
'chardet==5.2.0',
'charset-normalizer==3.3.2',
'urllib3>=1.26.19,<2;python_version<"3.10"',
'urllib3>=1.26.19,<2.3.0;python_version>="3.10"',
'urllib3>=1.26.20,<2;python_version<"3.10"',
'urllib3>=1.26.20,<2.3.0;python_version>="3.10"',
'requests==2.31.0',
"pynose==1.5.2",
'sniffio==1.3.1',
Expand Down