File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ from seleniumbase import SB
2
+
3
+ with SB (uc = True , test = True , incognito = True ) as sb :
4
+ url = "https://demo.fingerprint.com/playground"
5
+ sb .activate_cdp_mode (url )
6
+ sb .sleep (1 )
7
+ sb .cdp .highlight ('a[href*="browser-bot-detection"]' )
8
+ bot_row_selector = 'table:contains("Bot") tr:nth-of-type(3)'
9
+ print (sb .cdp .get_text (bot_row_selector ))
10
+ sb .cdp .assert_text ("Bot Not detected" , bot_row_selector )
11
+ sb .cdp .highlight (bot_row_selector )
12
+ sb .sleep (2 )
Original file line number Diff line number Diff line change
1
+ """To handle alerts in CDP Mode, reconnect and use WebDriver."""
2
+ from seleniumbase import SB
3
+
4
+ with SB (uc = True , test = True ) as sb :
5
+ url = "https://the-internet.herokuapp.com/javascript_alerts"
6
+ sb .activate_cdp_mode (url )
7
+ sb .reconnect ()
8
+ sb .cdp .gui_click_element ('button[onclick="jsAlert()"]' )
9
+ sb .sleep (1 )
10
+ sb .accept_alert ()
11
+ sb .sleep (1 )
12
+ sb .cdp .gui_click_element ('button[onclick="jsConfirm()"]' )
13
+ sb .sleep (1 )
14
+ sb .dismiss_alert ()
15
+ sb .sleep (1 )
16
+ sb .cdp .gui_click_element ('button[onclick="jsPrompt()"]' )
17
+ sb .sleep (1 )
18
+ sb .uc_gui_write ("Here is my prompt answer\n " )
19
+ sb .sleep (1 )
You can’t perform that action at this time.
0 commit comments