Skip to content

Commit f701970

Browse files
committed
Add a Stealthy Playwright example
1 parent 82c81a3 commit f701970

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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"))

0 commit comments

Comments
 (0)