@@ -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--------
0 commit comments