Skip to content

Commit cfe1139

Browse files
committed
Update the documentation
1 parent f08b984 commit cfe1139

File tree

5 files changed

+151
-124
lines changed

5 files changed

+151
-124
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/console_scripts/ReadMe.md">🌠 Scripts</a> |
2525
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mobile_testing.md">📱 Mobile</a>
2626
<br />
27-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md">📘 APIs</a> |
28-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md"> 🔠 Formats</a> |
27+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md">📘 API</a> |
28+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md"> 🔠 Syntaxes</a> |
2929
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md">🔴 Recorder</a> |
3030
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md">📊 Dashboard</a> |
31-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/locale_codes.md">🗾 Locales</a> |
31+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/locale_codes.md">🗾 Locale</a> |
3232
<a href="https://seleniumbase.io/devices/?url=seleniumbase.com">💻 Farm</a>
3333
<br />
3434
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/commander.md">🎖️ GUI</a> |
@@ -39,18 +39,17 @@
3939
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md">🌐 Grid</a>
4040
<br />
4141
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/how_it_works.md">👁️ How</a> |
42-
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/migration/raw_selenium">🚝 Migrate</a> |
43-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/case_plans.md">🗂️ CasePlans</a> |
44-
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/boilerplates">♻️ Template</a> |
45-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md">🧬 Hybrid</a> |
42+
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/migration/raw_selenium">🚝 Migration</a> |
43+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/playwright/ReadMe.md">🎭 Stealthy Playwright</a> |
44+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md">🛂 MasterQA</a> |
4645
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md">🚎 Tours</a>
4746
<br />
4847
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/github/workflows/ReadMe.md">🤖 CI/CD</a> |
4948
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/js_package_manager.md">🕹️ JSMgr</a> |
5049
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/translations.md">🌏 Translator</a> |
5150
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/ReadMe.md">🎞️ Presenter</a> |
52-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/dialog_boxes/ReadMe.md">🛂 Dialog</a> |
53-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md">🖼️ Visual</a>
51+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md">🖼️ Visual</a> |
52+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/case_plans.md">🗂️ CPlans</a>
5453
<br />
5554
</p>
5655

examples/cdp_mode/ReadMe.md

Lines changed: 70 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -620,63 +620,77 @@ sb.driver.stop()
620620

621621
### 🐙 <b translate="no">CDP Mode</b> Async API / Methods
622622

623+
Initialization:
624+
625+
```python
626+
from seleniumbase import cdp_driver
627+
628+
driver = await cdp_driver.start_async()
629+
tab = await driver.get(url, **kwargs)
630+
```
631+
632+
Methods: (Sometimes `tab` is named `page` in examples)
633+
623634
```python
624-
await get(url="about:blank")
625-
await open(url="about:blank")
626-
await find(text, best_match=False, timeout=10) # `text` can be a selector
627-
await find_all(text, timeout=10) # `text` can be a selector
628-
await select(selector, timeout=10)
629-
await select_all(selector, timeout=10, include_frames=False)
630-
await query_selector(selector)
631-
await query_selector_all(selector)
632-
await find_element_by_text(text, best_match=False)
633-
await find_elements_by_text(text)
634-
await reload(ignore_cache=True, script_to_evaluate_on_load=None)
635-
await evaluate(expression)
636-
await js_dumps(obj_name)
637-
await back()
638-
await forward()
639-
await get_window()
640-
await get_content()
641-
await maximize()
642-
await minimize()
643-
await fullscreen()
644-
await medimize()
645-
await set_window_size(left=0, top=0, width=1280, height=1024)
646-
await set_window_rect(left=0, top=0, width=1280, height=1024)
647-
await activate()
648-
await bring_to_front()
649-
await set_window_state(left=0, top=0, width=1280, height=720, state="normal")
650-
await get_navigation_history()
651-
await open_external_inspector() # Open a separate browser for debugging
652-
await close()
653-
await scroll_down(amount=25)
654-
await scroll_up(amount=25)
655-
await wait_for(selector="", text="", timeout=10)
656-
await download_file(url, filename=None)
657-
await save_screenshot(filename="auto", format="png", full_page=False)
658-
await print_to_pdf(filename="auto")
659-
await set_download_path(path)
660-
await get_all_linked_sources()
661-
await get_all_urls(absolute=True)
662-
await get_html()
663-
await get_page_source()
664-
await is_element_present(selector)
665-
await is_element_visible(selector)
666-
await get_element_rect(selector, timeout=5) # (relative to window)
667-
await get_window_rect()
668-
await get_gui_element_rect(selector, timeout=5) # (relative to screen)
669-
await get_title()
670-
await send_keys(selector, text, timeout=5)
671-
await type(selector, text, timeout=5)
672-
await click(selector, timeout=5)
673-
await click_with_offset(selector, x, y, center=False, timeout=5)
674-
await solve_captcha()
675-
await click_captcha() # Same as solve_captcha()
676-
await get_document()
677-
await get_flattened_document()
678-
await get_local_storage()
679-
await set_local_storage(items)
635+
await tab.get(url="about:blank")
636+
await tab.open(url="about:blank")
637+
await tab.find(text, best_match=False, timeout=10) # text can be selector
638+
await tab.find_all(text, timeout=10) # text can be selector
639+
await tab.select(selector, timeout=10)
640+
await tab.select_all(selector, timeout=10, include_frames=False)
641+
await tab.query_selector(selector)
642+
await tab.query_selector_all(selector)
643+
await tab.find_element_by_text(text, best_match=False)
644+
await tab.find_elements_by_text(text)
645+
await tab.reload(ignore_cache=True, script_to_evaluate_on_load=None)
646+
await tab.evaluate(expression)
647+
await tab.js_dumps(obj_name)
648+
await tab.back()
649+
await tab.forward()
650+
await tab.get_window()
651+
await tab.get_content()
652+
await tab.maximize()
653+
await tab.minimize()
654+
await tab.fullscreen()
655+
await tab.medimize()
656+
await tab.set_window_size(left=0, top=0, width=1280, height=1024)
657+
await tab.set_window_rect(left=0, top=0, width=1280, height=1024)
658+
await tab.activate()
659+
await tab.bring_to_front()
660+
await tab.set_window_state(
661+
left=0, top=0, width=1280, height=720, state="normal")
662+
await tab.get_navigation_history()
663+
await tab.open_external_inspector() # Open separate browser for debugging
664+
await tab.close()
665+
await tab.scroll_down(amount=25)
666+
await tab.scroll_up(amount=25)
667+
await tab.wait_for(selector="", text="", timeout=10)
668+
await tab.download_file(url, filename=None)
669+
await tab.save_screenshot(
670+
filename="auto", format="png", full_page=False)
671+
await tab.print_to_pdf(filename="auto")
672+
await tab.set_download_path(path)
673+
await tab.get_all_linked_sources()
674+
await tab.get_all_urls(absolute=True)
675+
await tab.get_html()
676+
await tab.get_page_source()
677+
await tab.is_element_present(selector)
678+
await tab.is_element_visible(selector)
679+
await tab.get_element_rect(selector, timeout=5) # (window-based)
680+
await tab.get_window_rect()
681+
await tab.get_gui_element_rect(selector, timeout=5) # (screen-based)
682+
await tab.get_title()
683+
await tab.get_current_url()
684+
await tab.send_keys(selector, text, timeout=5)
685+
await tab.type(selector, text, timeout=5)
686+
await tab.click(selector, timeout=5)
687+
await tab.click_with_offset(selector, x, y, center=False, timeout=5)
688+
await tab.solve_captcha()
689+
await tab.click_captcha() # Same as solve_captcha()
690+
await tab.get_document()
691+
await tab.get_flattened_document()
692+
await tab.get_local_storage()
693+
await tab.set_local_storage(items)
680694
```
681695

682696
--------

help_docs/ReadMe.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
<a href="https://seleniumbase.io/help_docs/recorder_mode/">🔴 Recorder</a> |
3636
<a href="https://seleniumbase.io/devices/?url=seleniumbase.io">💻 Device Farm</a>
3737
<br />
38+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/playwright/ReadMe.md">🎭 Stealthy Playwright Mode</a>
39+
<br />
3840
<a href="https://seleniumbase.io/examples/presenter/ReadMe/">🎞️ Slides</a> |
3941
<a href="https://seleniumbase.io/examples/chart_maker/ReadMe/">📶 Chart Maker</a>
4042
<br / >

help_docs/cdp_mode_methods.md

Lines changed: 70 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -258,63 +258,77 @@ sb.driver.stop()
258258

259259
### 🐙 <b translate="no">CDP Mode</b> Async API / Methods
260260

261+
Initialization:
262+
263+
```python
264+
from seleniumbase import cdp_driver
265+
266+
driver = await cdp_driver.start_async()
267+
tab = await driver.get(url, **kwargs)
268+
```
269+
270+
Methods: (Sometimes `tab` is named `page` in examples)
271+
261272
```python
262-
await get(url="about:blank")
263-
await open(url="about:blank")
264-
await find(text, best_match=False, timeout=10) # `text` can be a selector
265-
await find_all(text, timeout=10) # `text` can be a selector
266-
await select(selector, timeout=10)
267-
await select_all(selector, timeout=10, include_frames=False)
268-
await query_selector(selector)
269-
await query_selector_all(selector)
270-
await find_element_by_text(text, best_match=False)
271-
await find_elements_by_text(text)
272-
await reload(ignore_cache=True, script_to_evaluate_on_load=None)
273-
await evaluate(expression)
274-
await js_dumps(obj_name)
275-
await back()
276-
await forward()
277-
await get_window()
278-
await get_content()
279-
await maximize()
280-
await minimize()
281-
await fullscreen()
282-
await medimize()
283-
await set_window_size(left=0, top=0, width=1280, height=1024)
284-
await set_window_rect(left=0, top=0, width=1280, height=1024)
285-
await activate()
286-
await bring_to_front()
287-
await set_window_state(left=0, top=0, width=1280, height=720, state="normal")
288-
await get_navigation_history()
289-
await open_external_inspector() # Open a separate browser for debugging
290-
await close()
291-
await scroll_down(amount=25)
292-
await scroll_up(amount=25)
293-
await wait_for(selector="", text="", timeout=10)
294-
await download_file(url, filename=None)
295-
await save_screenshot(filename="auto", format="png", full_page=False)
296-
await print_to_pdf(filename="auto")
297-
await set_download_path(path)
298-
await get_all_linked_sources()
299-
await get_all_urls(absolute=True)
300-
await get_html()
301-
await get_page_source()
302-
await is_element_present(selector)
303-
await is_element_visible(selector)
304-
await get_element_rect(selector, timeout=5) # (relative to window)
305-
await get_window_rect()
306-
await get_gui_element_rect(selector, timeout=5) # (relative to screen)
307-
await get_title()
308-
await send_keys(selector, text, timeout=5)
309-
await type(selector, text, timeout=5)
310-
await click(selector, timeout=5)
311-
await click_with_offset(selector, x, y, center=False, timeout=5)
312-
await solve_captcha()
313-
await click_captcha() # Same as solve_captcha()
314-
await get_document()
315-
await get_flattened_document()
316-
await get_local_storage()
317-
await set_local_storage(items)
273+
await tab.get(url="about:blank")
274+
await tab.open(url="about:blank")
275+
await tab.find(text, best_match=False, timeout=10) # text can be selector
276+
await tab.find_all(text, timeout=10) # text can be selector
277+
await tab.select(selector, timeout=10)
278+
await tab.select_all(selector, timeout=10, include_frames=False)
279+
await tab.query_selector(selector)
280+
await tab.query_selector_all(selector)
281+
await tab.find_element_by_text(text, best_match=False)
282+
await tab.find_elements_by_text(text)
283+
await tab.reload(ignore_cache=True, script_to_evaluate_on_load=None)
284+
await tab.evaluate(expression)
285+
await tab.js_dumps(obj_name)
286+
await tab.back()
287+
await tab.forward()
288+
await tab.get_window()
289+
await tab.get_content()
290+
await tab.maximize()
291+
await tab.minimize()
292+
await tab.fullscreen()
293+
await tab.medimize()
294+
await tab.set_window_size(left=0, top=0, width=1280, height=1024)
295+
await tab.set_window_rect(left=0, top=0, width=1280, height=1024)
296+
await tab.activate()
297+
await tab.bring_to_front()
298+
await tab.set_window_state(
299+
left=0, top=0, width=1280, height=720, state="normal")
300+
await tab.get_navigation_history()
301+
await tab.open_external_inspector() # Open separate browser for debugging
302+
await tab.close()
303+
await tab.scroll_down(amount=25)
304+
await tab.scroll_up(amount=25)
305+
await tab.wait_for(selector="", text="", timeout=10)
306+
await tab.download_file(url, filename=None)
307+
await tab.save_screenshot(
308+
filename="auto", format="png", full_page=False)
309+
await tab.print_to_pdf(filename="auto")
310+
await tab.set_download_path(path)
311+
await tab.get_all_linked_sources()
312+
await tab.get_all_urls(absolute=True)
313+
await tab.get_html()
314+
await tab.get_page_source()
315+
await tab.is_element_present(selector)
316+
await tab.is_element_visible(selector)
317+
await tab.get_element_rect(selector, timeout=5) # (window-based)
318+
await tab.get_window_rect()
319+
await tab.get_gui_element_rect(selector, timeout=5) # (screen-based)
320+
await tab.get_title()
321+
await tab.get_current_url()
322+
await tab.send_keys(selector, text, timeout=5)
323+
await tab.type(selector, text, timeout=5)
324+
await tab.click(selector, timeout=5)
325+
await tab.click_with_offset(selector, x, y, center=False, timeout=5)
326+
await tab.solve_captcha()
327+
await tab.click_captcha() # Same as solve_captcha()
328+
await tab.get_document()
329+
await tab.get_flattened_document()
330+
await tab.get_local_storage()
331+
await tab.set_local_storage(items)
318332
```
319333

320334
--------

help_docs/js_package_manager.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ self.add_js_link(js_link)
5353
<p><div>🕹️ This example loads the <a href="https://introjs.com/">IntroJS</a> JavaScript library:</div></p>
5454

5555
```python
56-
self.add_js_link("https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/intro.min.js")
56+
self.add_js_link("https://cdn.jsdelivr.net/npm/intro.js@5.1.0/intro.min.js")
5757
```
5858

5959
<div>🕹️ You can load any JS package this way as long as you know the URL.</div>
@@ -133,8 +133,6 @@ pytest test_dialog_boxes.py
133133

134134
<a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="220"></a>
135135

136-
[<img src="https://seleniumbase.github.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="220">](https://github.com/seleniumbase/SeleniumBase/)
137-
138136
<div>To learn more about SeleniumBase, check out the Docs Site:</div>
139137
<a href="https://seleniumbase.io">
140138
<img src="https://img.shields.io/badge/docs-%20%20SeleniumBase.io-11BBDD.svg" alt="SeleniumBase.io Docs" /></a>

0 commit comments

Comments
 (0)