Add a new CDP Mode example

This commit is contained in:
Michael Mintz 2025-03-05 13:13:37 -05:00
parent cbcac523c8
commit d1075608da
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
from seleniumbase import SB
with SB(uc=True) as sb:
sb.activate_cdp_mode()
sb.open("data:text/html,<h1>Page A</h1>")
sb.assert_text("Page A")
sb.open_new_tab()
sb.open("data:text/html,<h1>Page B</h1>")
sb.assert_text("Page B")
sb.switch_to_tab(0)
sb.assert_text("Page A")
sb.assert_text_not_visible("Page B")
sb.switch_to_tab(1)
sb.assert_text("Page B")
sb.assert_text_not_visible("Page A")