File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
examples/cdp_mode/playwright Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ from playwright .sync_api import sync_playwright
2+ from seleniumbase import SB
3+
4+ with SB (uc = True , locale = "en" ) as sb :
5+ sb .activate_cdp_mode ()
6+ endpoint_url = sb .cdp .get_endpoint_url ()
7+
8+ with sync_playwright () as p :
9+ browser = p .chromium .connect_over_cdp (endpoint_url )
10+ page = browser .contexts [0 ].pages [0 ]
11+ page .goto ("https://www.browserscan.net/bot-detection" )
12+ page .wait_for_timeout (1000 )
13+ sb .cdp .flash ("Test Results" , duration = 4 )
14+ page .wait_for_timeout (1000 )
15+ sb .assert_element ('strong:contains("Normal")' )
16+ sb .cdp .flash ('strong:contains("Normal")' , duration = 4 , pause = 4 )
Original file line number Diff line number Diff line change 1+ from playwright .sync_api import sync_playwright
2+ from seleniumbase import sb_cdp
3+
4+ sb = sb_cdp .Chrome (locale = "en" )
5+ endpoint_url = sb .get_endpoint_url ()
6+
7+ with sync_playwright () as p :
8+ browser = p .chromium .connect_over_cdp (endpoint_url )
9+ page = browser .contexts [0 ].pages [0 ]
10+ page .goto ("https://www.browserscan.net/bot-detection" )
11+ page .wait_for_timeout (1000 )
12+ sb .flash ("Test Results" , duration = 4 )
13+ page .wait_for_timeout (1000 )
14+ sb .assert_element ('strong:contains("Normal")' )
15+ sb .flash ('strong:contains("Normal")' , duration = 4 , pause = 4 )
You can’t perform that action at this time.
0 commit comments