File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
examples/cdp_mode/playwright Expand file tree Collapse file tree 1 file changed +24
-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_cdp
3+
4+ sb = sb_cdp .Chrome (locale = "en" , ad_block = True )
5+ endpoint_url = sb .get_endpoint_url ()
6+
7+ with sync_playwright () as p :
8+ browser = p .chromium .connect_over_cdp (endpoint_url )
9+ context = browser .contexts [0 ]
10+ page = context .pages [0 ]
11+ page .goto ("https://seatgeek.com/" )
12+ input_field = 'input[name="search"]'
13+ page .wait_for_selector (input_field )
14+ sb .sleep (1.6 )
15+ query = "Jerry Seinfeld"
16+ sb .press_keys (input_field , query )
17+ sb .sleep (1.6 )
18+ page .click ("li#active-result-item" )
19+ sb .sleep (4.2 )
20+ print ('*** SeatGeek Search for "%s":' % query )
21+ items = page .locator ('[data-testid="listing-item"]' )
22+ for i in range (items .count ()):
23+ item_text = items .nth (i ).inner_text ()
24+ print (item_text .replace ("\n \n " , "\n " ))
You can’t perform that action at this time.
0 commit comments