Skip to content
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<p align="center" class="hero__title"><b>Automate, test, and scrape the web — on your own terms.<br /></b></p>

<p align="center"><a href="https://pypi.python.org/pypi/seleniumbase" target="_blank"><img src="https://img.shields.io/pypi/v/seleniumbase.svg?color=3399EE" alt="PyPI version" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/releases" target="_blank"><img src="https://img.shields.io/github/v/release/seleniumbase/SeleniumBase.svg?color=22AAEE" alt="GitHub version" /></a> <a href="https://seleniumbase.io"><img src="https://img.shields.io/badge/docs-seleniumbase.io-11BBAA.svg" alt="SeleniumBase Docs" /></a></p>
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/actions" target="_blank"><img src="https://github.com/seleniumbase/SeleniumBase/workflows/CI%20build/badge.svg" alt="SeleniumBase GitHub Actions" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/stargazers"><img src="https://img.shields.io/github/stars/seleniumbase/SeleniumBase?style=social"></a> <a href="https://discord.gg/EdhQTn3EyE" target="_blank"><img src="https://img.shields.io/discord/727927627830001734?color=7289DA&label=Discord&logo=discord&logoColor=white"/></a></p>
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/actions" target="_blank"><img src="https://github.com/seleniumbase/SeleniumBase/workflows/CI%20build/badge.svg" alt="SeleniumBase GitHub Actions" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/stargazers"><img src="https://img.shields.io/github/stars/seleniumbase/SeleniumBase?style=social"></a> <a href="https://pepy.tech/projects/seleniumbase?timeRange=threeMonths&category=version&includeCIDownloads=true&granularity=daily&viewType=line&versions=*" target="_blank"><img src="https://static.pepy.tech/badge/seleniumbase" alt="SeleniumBase PyPI downloads" /></a> <a href="https://discord.gg/EdhQTn3EyE" target="_blank"><img src="https://img.shields.io/discord/727927627830001734?color=7289DA&label=Discord&logo=discord&logoColor=white"/></a></p>

<p align="center">
<a href="#python_installation">🚀 Start</a> |
Expand Down Expand Up @@ -54,7 +54,7 @@
<br />
</p>

<p>SeleniumBase is a browser automation framework for the modern web. Whether you're new or experienced in Python, SeleniumBase makes it easy to get started. With special features like Stealth Mode (UC Mode / CDP Mode), you'll be evading bot-detection and bypassing CAPTCHAs in minutes.</p>
<p>SeleniumBase is a browser automation framework for the modern web. Both new and experienced Python users alike can easily get started. With special stealth features like UC Mode and CDP Mode, you'll be evading bot-detection and bypassing CAPTCHAs in minutes.</p>

--------

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ websocket-client~=1.8.0;python_version<"3.9"
websocket-client~=1.9.0;python_version>="3.9"
selenium==4.27.1;python_version<"3.9"
selenium==4.32.0;python_version>="3.9" and python_version<"3.10"
selenium==4.36.0;python_version>="3.10"
selenium==4.37.0;python_version>="3.10"
cssselect==1.2.0;python_version<"3.9"
cssselect==1.3.0;python_version>="3.9"
sortedcontainers==2.4.0
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.42.6"
__version__ = "4.43.0"
9 changes: 2 additions & 7 deletions seleniumbase/console_scripts/sb_mkdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,17 +636,12 @@ def main():
data.append("")
data.append("class GoogleTests(BaseCase):")
data.append(" def test_google_dot_com(self):")
data.append(" if self.headless:")
data.append(' self.skip("Skipping test in headless mode.")')
data.append(" if not self.undetectable:")
data.append(" self.get_new_driver(undetectable=True)")
data.append(' self.open("https://google.com/ncr")')
data.append(' self.assert_title_contains("Google")')
data.append(" self.sleep(0.05)")
data.append(" self.save_screenshot_to_logs()")
data.append(
" self.wait_for_element('iframe[role=\"presentation\"]')"
)
data.append(" self.hide_elements('iframe')")
data.append(" self.sleep(0.05)")
data.append(" self.save_screenshot_to_logs()")
data.append(' self.type(HomePage.search_box, "github.com")')
data.append(" self.assert_element(HomePage.search_button)")
Expand Down
55 changes: 16 additions & 39 deletions seleniumbase/core/sb_cdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,46 +187,23 @@ def find_element_by_text(self, text, tag_name=None, timeout=None):
element with the given tag. (Eg: a, button, div, script, span)"""
if not timeout:
timeout = settings.SMALL_TIMEOUT
self.__add_light_pause()
time_now = time.time()
self.assert_text(text, timeout=timeout)
spent = int(time.time() - time_now)
remaining = 1 + timeout - spent
if tag_name:
self.assert_element(tag_name, timeout=remaining)
elements = self.loop.run_until_complete(
self.page.find_elements_by_text(text=text)
)
if tag_name:
tag_name = tag_name.lower().strip()
for element in elements:
if element and not tag_name:
element = self.__add_sync_methods(element)
return self.__add_sync_methods(element)
elif (
element
and tag_name in element.tag_name.lower()
and text.strip() in element.text
):
element = self.__add_sync_methods(element)
return self.__add_sync_methods(element)
elif (
element
and element.parent
and tag_name in element.parent.tag_name.lower()
and text.strip() in element.parent.text
):
element = self.__add_sync_methods(element.parent)
return self.__add_sync_methods(element)
elif (
element
and element.parent
and element.parent.parent
and tag_name in element.parent.parent.tag_name.lower()
and text.strip() in element.parent.parent.text
):
element = self.__add_sync_methods(element.parent.parent)
return self.__add_sync_methods(element)
try:
return self.find_element(
'%s:contains("%s")' % (tag_name, text), timeout=timeout
)
except Exception:
pass # The exception will be raised later
else:
self.__add_light_pause()
self.assert_text(text, timeout=timeout)
elements = self.loop.run_until_complete(
self.page.find_elements_by_text(text=text)
)
for element in elements:
if element:
element = self.__add_sync_methods(element)
return self.__add_sync_methods(element)
plural = "s"
if timeout == 1:
plural = ""
Expand Down
4 changes: 3 additions & 1 deletion seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -10173,7 +10173,7 @@ def wait_for_text_visible(
text = self.__get_type_checked_text(text)
selector, by = self.__recalculate_selector(selector, by)
if self.__is_cdp_swap_needed():
return self.cdp.find_element(selector, timeout=timeout)
return self.cdp.wait_for_text(text, selector, timeout=timeout)
elif self.__is_shadow_selector(selector):
return self.__wait_for_shadow_text_visible(text, selector, timeout)
return page_actions.wait_for_text_visible(
Expand Down Expand Up @@ -10530,6 +10530,8 @@ def wait_for_link_text_visible(self, link_text, timeout=None):
timeout = settings.LARGE_TIMEOUT
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
if self.__is_cdp_swap_needed():
return self.cdp.find_element_by_text(text=link_text, tag_name="a")
return self.wait_for_element_visible(
link_text, by="link text", timeout=timeout
)
Expand Down
3 changes: 2 additions & 1 deletion seleniumbase/undetected/cdp_driver/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ async def get(
proxy_user = username_and_password.split(":")[0]
proxy_pass = username_and_password.split(":")[1]
await connection.set_auth(proxy_user, proxy_pass, self.tabs[0])
time.sleep(0.25)
time.sleep(0.22)
await connection.sleep(0.05)
frame_id, loader_id, *_ = await connection.send(
cdp.page.navigate(url)
)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
'websocket-client~=1.9.0;python_version>="3.9"',
'selenium==4.27.1;python_version<"3.9"',
'selenium==4.32.0;python_version>="3.9" and python_version<"3.10"',
'selenium==4.36.0;python_version>="3.10"',
'selenium==4.37.0;python_version>="3.10"',
'cssselect==1.2.0;python_version<"3.9"',
'cssselect==1.3.0;python_version>="3.9"',
"sortedcontainers==2.4.0",
Expand Down Expand Up @@ -277,7 +277,7 @@
'pdfminer.six==20250324;python_version<"3.9"',
'pdfminer.six==20250506;python_version>="3.9"',
'cryptography==39.0.2;python_version<"3.9"',
'cryptography==46.0.2;python_version>="3.9"',
'cryptography==46.0.3;python_version>="3.9"',
'cffi==1.17.1;python_version<"3.9"',
'cffi==2.0.0;python_version>="3.9"',
'pycparser==2.22;python_version<"3.9"',
Expand Down