Skip to content

Commit dff8c25

Browse files
committed
Update the docs
1 parent f701970 commit dff8c25

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

help_docs/syntax_formats.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
<li><a href="#sb_sf_21"><strong>21. SeleniumBase SB (Python context manager)</strong></a></li>
3333
<li><a href="#sb_sf_22"><strong>22. The driver manager (via context manager)</strong></a></li>
3434
<li><a href="#sb_sf_23"><strong>23. The driver manager (via direct import)</strong></a></li>
35-
<li><a href="#sb_sf_24"><strong>24. CDP driver (async/await API. No Selenium)</strong></a></li>
36-
<li><a href="#sb_sf_25"><strong>25. CDP driver (SB CDP Sync API. No Selenium)</strong></a></li>
35+
<li><a href="#sb_sf_24"><strong>24. Pure CDP Mode (Async API. No Selenium)</strong></a></li>
36+
<li><a href="#sb_sf_25"><strong>25. Pure CDP Mode (Sync API. No Selenium)</strong></a></li>
3737
</ul>
3838
</blockquote>
3939

@@ -1020,9 +1020,9 @@ The ``Driver()`` manager format can be used as a drop-in replacement for virtual
10201020
When using the ``Driver()`` format, you may need to activate a Virtual Display on your own if you want to run headed tests in a headless Linux environment. (See https://github.com/mdmintz/sbVirtualDisplay for details.) One such example of this is using an authenticated proxy, which is configured via a Chrome extension that is generated at runtime. (Note that regular headless mode in Chrome doesn't support extensions.)
10211021

10221022
<a id="sb_sf_24"></a>
1023-
<h2><img src="https://seleniumbase.github.io/img/logo3b.png" title="SeleniumBase" width="32" /> 24. CDP driver (async/await API. No Selenium)</h2>
1023+
<h2><img src="https://seleniumbase.github.io/img/logo3b.png" title="SeleniumBase" width="32" /> 24. Pure CDP Mode (Async API. No Selenium)</h2>
10241024

1025-
This format provides a pure CDP way of using SeleniumBase (without Selenium or a test runner). The async/await API is used. Here's an example:
1025+
This format provides a pure CDP way of using SeleniumBase (without Selenium/WebDriver or a test runner). The <code>async</code>/<code>await</code> API is used. Here's an example:
10261026

10271027
```python
10281028
import asyncio
@@ -1053,9 +1053,33 @@ if __name__ == "__main__":
10531053
(See <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/raw_basic_async.py">examples/cdp_mode/raw_basic_async.py</a> for the test.)
10541054

10551055
<a id="sb_sf_25"></a>
1056-
<h2><img src="https://seleniumbase.github.io/img/logo3b.png" title="SeleniumBase" width="32" /> 25. CDP driver (SB CDP Sync API. No Selenium)</h2>
1056+
<h2><img src="https://seleniumbase.github.io/img/logo3b.png" title="SeleniumBase" width="32" /> 25. Pure CDP Mode (Sync API. No Selenium)</h2>
10571057

1058-
This format provides a pure CDP way of using SeleniumBase (without Selenium/WebDriver or a test runner). The expanded SB CDP Sync API is used. Here's an example:
1058+
This format provides a pure CDP way of using SeleniumBase (without Selenium/WebDriver or a test runner). The expanded <code>sb_cdp</code> Sync API is used. Here's an example:
1059+
1060+
```python
1061+
from seleniumbase import sb_cdp
1062+
1063+
url = "https://seleniumbase.io/simple/login"
1064+
sb = sb_cdp.Chrome(url)
1065+
sb.type("#username", "demo_user")
1066+
sb.type("#password", "secret_pass")
1067+
sb.click('a:contains("Sign in")')
1068+
sb.assert_exact_text("Welcome!", "h1")
1069+
sb.assert_element("img#image1")
1070+
sb.highlight("#image1")
1071+
top_nav = sb.find_element("div.topnav")
1072+
links = top_nav.query_selector_all("a")
1073+
for nav_item in links:
1074+
print(nav_item.text)
1075+
sb.click_link("Sign out")
1076+
sb.assert_text("signed out", "#top_message")
1077+
sb.driver.stop()
1078+
```
1079+
1080+
(See <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/raw_basic_cdp.py">examples/cdp_mode/raw_basic_cdp.py</a> for the test.)
1081+
1082+
Here's a Pure CDP Mode example that bypasses bot-detection to scrape data from a website:
10591083

10601084
```python
10611085
from seleniumbase import sb_cdp

mkdocs_build/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Minimum Python version: 3.10 (for generating docs only)
33

44
regex>=2025.11.3
5-
pymdown-extensions>=10.18
5+
pymdown-extensions>=10.19
66
pipdeptree>=2.30.0
77
python-dateutil>=2.8.2
88
Markdown==3.10

0 commit comments

Comments
 (0)