File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1+ from contextlib import suppress
12from seleniumbase import SB
23
34with SB (uc = True , test = True , ad_block = True ) as sb :
67 query = "Compare Playwright to SeleniumBase in under 178 words"
78 sb .type ("#prompt-textarea" , query )
89 sb .click ('button[data-testid="send-button"]' )
9- print ('Input for ChatGPT:\n "%s"' % query )
10- sb .sleep (12 )
10+ print ('*** Input for ChatGPT: ***\n "%s"' % query )
11+ with suppress (Exception ):
12+ # The "Send" button reappears when ChatGPT is done typing a response
13+ sb .wait_for_element ('button[data-testid="send-button"]' , timeout = 22 )
1114 chat = sb .find_element ('[data-message-author-role="assistant"] .markdown' )
1215 soup = sb .get_beautiful_soup (chat .get_html ()).get_text ("\n " ).strip ()
13- print ("Response from ChatGPT:\n %s" % soup .replace ("\n :" , ":" ))
16+ print ("*** Response from ChatGPT: ***\n %s" % soup .replace ("\n :" , ":" ))
17+ sb .sleep (3 )
You can’t perform that action at this time.
0 commit comments