Skip to content

Commit dc986e0

Browse files
committed
Update the docs
1 parent 04ec335 commit dc986e0

File tree

4 files changed

+23
-24
lines changed

4 files changed

+23
-24
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ with SB(test=True, uc=True) as sb:
9090
```python
9191
from seleniumbase import SB
9292

93-
with SB(uc=True, test=True, locale_code="en") as sb:
93+
with SB(uc=True, test=True, locale="en") as sb:
9494
url = "https://gitlab.com/users/sign_in"
9595
sb.activate_cdp_mode(url)
9696
sb.uc_gui_click_captcha()

help_docs/syntax_formats.md

+10-19
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
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>
3535
<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>
36+
<li><a href="#sb_sf_25"><strong>25. CDP driver (SB CDP Sync API. No Selenium)</strong></a></li>
3737
</ul>
3838
</blockquote>
3939

@@ -1019,14 +1019,13 @@ This format provides a pure CDP way of using SeleniumBase (without Selenium or a
10191019
```python
10201020
import asyncio
10211021
import time
1022-
from seleniumbase.undetected import cdp_driver
1022+
from seleniumbase import cdp_driver
10231023

10241024

10251025
async def main():
1026-
driver = await cdp_driver.cdp_util.start_async()
1027-
page = await driver.get("about:blank")
1028-
await page.set_locale("en")
1029-
await page.get("https://www.priceline.com/")
1026+
url = "https://www.priceline.com/"
1027+
driver = await cdp_driver.start_async(lang="en")
1028+
page = await driver.get(url)
10301029
time.sleep(3)
10311030
print(await page.evaluate("document.title"))
10321031
element = await page.select('[data-testid*="endLocation"]')
@@ -1043,25 +1042,17 @@ if __name__ == "__main__":
10431042
(See <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/raw_async.py">examples/cdp_mode/raw_async.py</a> for the test.)
10441043

10451044
<a id="sb_sf_25"></a>
1046-
<h2><img src="https://seleniumbase.github.io/img/logo3b.png" title="SeleniumBase" width="32" /> 25. CDP driver (SB-CDP sync API. No Selenium)</h2>
1045+
<h2><img src="https://seleniumbase.github.io/img/logo3b.png" title="SeleniumBase" width="32" /> 25. CDP driver (SB CDP Sync API. No Selenium)</h2>
10471046

1048-
This format provides a pure CDP way of using SeleniumBase (without Selenium or a test runner). The expanded SB-CDP sync API is used. Here's an example:
1047+
This format provides a pure CDP way of using SeleniumBase (without Selenium or a test runner). The expanded SB CDP Sync API is used. Here's an example:
10491048

10501049
```python
1051-
import asyncio
1052-
from seleniumbase.core import sb_cdp
1053-
from seleniumbase.undetected import cdp_driver
1050+
from seleniumbase import sb_cdp
10541051

10551052

10561053
def main():
1057-
url0 = "about:blank" # Set Locale code from here first
1058-
url1 = "https://www.priceline.com/" # (The "real" URL)
1059-
loop = asyncio.new_event_loop()
1060-
driver = cdp_driver.cdp_util.start_sync()
1061-
page = loop.run_until_complete(driver.get(url0))
1062-
sb = sb_cdp.CDPMethods(loop, page, driver)
1063-
sb.set_locale("en") # This test expects English locale
1064-
sb.open(url1)
1054+
url = "https://www.priceline.com/"
1055+
sb = sb_cdp.Chrome(url, lang="en")
10651056
sb.sleep(2.5)
10661057
sb.internalize_links() # Don't open links in a new tab
10671058
sb.click("#link_header_nav_experiences")

help_docs/uc_mode.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Sometimes you need to add <code translate="no">incognito=True</code> with <code
104104
```python
105105
from seleniumbase import SB
106106

107-
with SB(uc=True, test=True, incognito=True, locale_code="en") as sb:
107+
with SB(uc=True, test=True, incognito=True, locale="en") as sb:
108108
url = "https://ahrefs.com/website-authority-checker"
109109
input_field = 'input[placeholder="Enter domain"]'
110110
submit_button = 'span:contains("Check Authority")'

integrations/docker/ReadMe.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ https://docs.docker.com/engine/install/
1212

1313
#### 3. Create your Docker image from your Dockerfile: (Get ready to wait awhile)
1414

15+
**(Windows / Linux / Intel macOS)**
16+
1517
docker build -t seleniumbase .
1618

17-
**(NOTE) - If running on an Apple M1/M2 Mac, use this instead:**
19+
**(Apple Silicon macOS, eg. M1/M2/M3/M4):**
1820

19-
docker build --platform linux/amd64 -t seleniumbase .
21+
Users should first [Enable Rosetta in Docker Desktop](https://stackoverflow.com/a/76586216/7058266). (Otherwise Chrome will crash on launch with errors such as: `"InvalidSessionIdException"` and `"Unable to receive message from renderer"`)
22+
23+
<img width="420" alt="Enable Rosetta" src="https://seleniumbase.github.io/other/docker_rosetta.jpg" />
2024

21-
**M1/M2 Mac users** should also see [StackOverflow.com/a/76586216/7058266](https://stackoverflow.com/a/76586216/7058266) to **Enable Rosetta in Docker Desktop**. (Otherwise **you will** encounter errors like this when Chrome tries to launch: `"Chrome failed to start: crashed."`)
25+
Then you can run these commands:
26+
27+
export DOCKER_DEFAULT_PLATFORM=linux/amd64
28+
29+
docker build --platform linux/amd64 -t seleniumbase .
2230

2331
#### 4. Run [the example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) with Chrome inside your Docker: (Once the test completes after a few seconds, you'll automatically exit the Docker shell)
2432

0 commit comments

Comments
 (0)