File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ from seleniumbase import sb_cdp
2+
3+ try :
4+ url = "https://copilot.microsoft.com/"
5+ sb = sb_cdp .Chrome (url , locale = "en" , guest = True )
6+ textarea = "textarea#userInput"
7+ sb .wait_for_element (textarea )
8+ sb .sleep (1.5 )
9+ sb .click_if_visible ('[aria-label="Dismiss"]' )
10+ sb .sleep (0.5 )
11+ sb .click ('button[data-testid*="chat-mode-"]' )
12+ sb .sleep (1.1 )
13+ sb .click ('button[title="Think Deeper"]' )
14+ sb .sleep (1.1 )
15+ query = "How to start automating with SeleniumBase?"
16+ sb .press_keys (textarea , query )
17+ sb .sleep (1.1 )
18+ sb .click ('button[data-testid="submit-button"]' )
19+ sb .sleep (2.5 )
20+ sb .gui_click_captcha ()
21+ sb .sleep (2.5 )
22+ sb .gui_click_captcha ()
23+ sb .sleep (3.5 )
24+ stop_button = '[data-testid="stop-button"]'
25+ thumbs_up = 'button[data-testid*="-thumbs-up-"]'
26+ sb .wait_for_element_absent (stop_button , timeout = 45 )
27+ sb .wait_for_element (thumbs_up , timeout = 20 )
28+ sb .sleep (0.6 )
29+ sb .click ('button[data-testid*="scroll-to-bottom"]' )
30+ sb .sleep (2.2 )
31+ folder = "downloaded_files"
32+ file_name = "copilot_results.html"
33+ sb .save_as_html (file_name , folder )
34+ print ('"./%s/%s" was saved!' % (folder , file_name ))
35+ sb .driver .stop ()
36+ except Exception :
37+ print ("Something failed!" )
You can’t perform that action at this time.
0 commit comments