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
1 change: 1 addition & 0 deletions examples/cdp_mode/raw_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async def main():
time.sleep(1)
element = await page.select("h1")
assert element.text == "Welcome!"
driver.stop()

if __name__ == "__main__":
# Call an async function with awaited methods
Expand Down
24 changes: 14 additions & 10 deletions help_docs/syntax_formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -1021,18 +1021,20 @@ import asyncio
import time
from seleniumbase import cdp_driver


async def main():
url = "https://www.priceline.com/"
driver = await cdp_driver.start_async(lang="en")
url = "seleniumbase.io/simple/login"
driver = await cdp_driver.start_async(incognito=True)
page = await driver.get(url)
time.sleep(3)
print(await page.evaluate("document.title"))
element = await page.select('[data-testid*="endLocation"]')
element = await page.select("#username")
await element.send_keys_async("demo_user")
element = await page.select("#password")
await element.send_keys_async("secret_pass")
element = await page.select("#log-in")
await element.click_async()
time.sleep(1)
await element.send_keys_async("Boston")
time.sleep(2)
element = await page.select("h1")
assert element.text == "Welcome!"
driver.stop()

if __name__ == "__main__":
Expand All @@ -1050,7 +1052,7 @@ This format provides a pure CDP way of using SeleniumBase (without Selenium or a
```python
from seleniumbase import sb_cdp


@decorators.print_runtime("CDP Priceline Example")
def main():
url = "https://www.priceline.com/"
sb = sb_cdp.Chrome(url, lang="en")
Expand All @@ -1063,11 +1065,14 @@ def main():
location = "Amsterdam"
where_to = 'div[data-automation*="experiences"] input'
button = 'button[data-automation*="experiences-search"]'
sb.wait_for_text("Where to?")
sb.gui_click_element(where_to)
sb.press_keys(where_to, location)
sb.sleep(1)
sb.gui_click_element(button)
sb.sleep(3)
sb.sleep(2)
sb.click_if_visible('button[aria-label="Close"]')
sb.sleep(1)
print(sb.get_title())
print("************")
for i in range(8):
Expand All @@ -1078,7 +1083,6 @@ def main():
print("* %s" % card.text)
sb.driver.stop()


if __name__ == "__main__":
main()
```
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ six>=1.17.0
parse>=1.20.2
parse-type>=0.6.6
colorama>=0.4.6
pyyaml>=6.0.2
pyyaml>=6.0.3
pygments>=2.19.2
pyreadline3>=3.5.3;platform_system=="Windows"
tabcompleter>=1.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.41.9"
__version__ = "4.41.10"
2 changes: 2 additions & 0 deletions seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,8 @@ def _uc_gui_click_captcha(
ctype=None,
):
cdp_mode_on_at_start = __is_cdp_swap_needed(driver)
if cdp_mode_on_at_start and (not ctype or ctype == "cf_t"):
return driver.cdp.gui_click_captcha()
_on_a_captcha_page = None
if ctype == "cf_t":
if not _on_a_cf_turnstile_page(driver):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
'parse>=1.20.2',
'parse-type>=0.6.6',
'colorama>=0.4.6',
'pyyaml>=6.0.2',
'pyyaml>=6.0.3',
'pygments>=2.19.2',
'pyreadline3>=3.5.3;platform_system=="Windows"',
"tabcompleter>=1.4.0",
Expand Down