Skip to content

Commit 3b9f8fc

Browse files
committed
Update CDP Mode examples
1 parent 8bb7dc6 commit 3b9f8fc

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from seleniumbase import SB
2+
3+
with SB(uc=True, test=True, mobile=True) as sb:
4+
url = "https://gitlab.com/users/sign_in"
5+
sb.activate_cdp_mode(url)
6+
sb.sleep(2)
7+
sb.solve_captcha()
8+
# (The rest is for testing and demo purposes)
9+
sb.assert_text("Username", '[for="user_login"]', timeout=3)
10+
sb.assert_element('label[for="user_login"]')
11+
sb.highlight('button:contains("Sign in")')
12+
sb.highlight('h1:contains("GitLab")')
13+
sb.post_message("SeleniumBase wasn't detected", duration=4)

examples/cdp_mode/raw_cdp_mobile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
loop.run_until_complete(
88
tab.send(
99
mycdp.emulation.set_device_metrics_override(
10-
width=411, height=731, device_scale_factor=3, mobile=True
10+
width=412, height=732, device_scale_factor=3, mobile=True
1111
)
1212
)
1313
)

examples/cdp_mode/raw_mobile_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async def main():
1010
driver = await cdp_driver.start_async()
1111
await driver.main_tab.send(
1212
mycdp.emulation.set_device_metrics_override(
13-
width=411, height=731, device_scale_factor=3, mobile=True
13+
width=412, height=732, device_scale_factor=3, mobile=True
1414
)
1515
)
1616
page = await driver.get(url, lang="en")

examples/cdp_mode/raw_mobile_gitlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
loop.run_until_complete(
1010
tab.send(
1111
mycdp.emulation.set_device_metrics_override(
12-
width=411, height=731, device_scale_factor=3, mobile=True
12+
width=412, height=732, device_scale_factor=3, mobile=True
1313
)
1414
)
1515
)

examples/cdp_mode/raw_mobile_roblox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
loop.run_until_complete(
1414
tab.send(
1515
mycdp.emulation.set_device_metrics_override(
16-
width=411, height=731, device_scale_factor=3, mobile=True
16+
width=412, height=732, device_scale_factor=3, mobile=True
1717
)
1818
)
1919
)

examples/cdp_mode/raw_stopandshop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Test Stop & Shop search. Non-US IPs might be blocked."""
22
from seleniumbase import SB
33

4-
with SB(uc=True, test=True, guest=True, ad_block=True) as sb:
4+
with SB(uc=True, test=True, ad_block=True) as sb:
55
url = "https://stopandshop.com/"
66
sb.activate_cdp_mode(url)
77
sb.sleep(2.6)

0 commit comments

Comments
 (0)