Skip to content

Commit e000bcc

Browse files
committed
Add a new CDP example
1 parent 26d782b commit e000bcc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from seleniumbase import SB
2+
3+
agent = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36"
4+
agent += " (KHTML, like Gecko) Mobile Safari/537.36"
5+
6+
sites = ["facebook", "twitter", "linkedin", "youtube", "firefox", "amazon"]
7+
sites += ["chatgpt", "gmail", "perplexity", "snapchat", "tiktok", "roblox"]
8+
urls = [f"https://www.{site}.com" for site in sites]
9+
10+
for url in urls:
11+
with SB(uc=True, test=True, mobile=True) as sb:
12+
sb.set_window_position(20, 54)
13+
sb.activate_cdp_mode()
14+
sb.open(url)
15+
sb.sleep(2)
16+
sb.get_new_driver()
17+
sb.set_window_position(550, 54)
18+
sb.activate_cdp_mode(agent=agent)
19+
sb.open(url)
20+
sb.sleep(8)

0 commit comments

Comments
 (0)