Skip to content

Commit 5c6684b

Browse files
authored
Merge pull request #4117 from seleniumbase/cdp-mode-patch-76
CDP Mode: Patch 76
2 parents d7c4af5 + 4986d39 commit 5c6684b

29 files changed

+97
-49
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ with SB(uc=True, test=True, locale="en") as sb:
118118
from seleniumbase import sb_cdp
119119

120120
url = "https://gitlab.com/users/sign_in"
121-
sb = sb_cdp.Chrome(url)
122-
sb.sleep(2.5)
121+
sb = sb_cdp.Chrome(url, incognito=True)
122+
sb.sleep(2)
123123
sb.solve_captcha()
124124
sb.highlight('h1:contains("GitLab")')
125125
sb.highlight('button:contains("Sign in")')

examples/cdp_mode/ReadMe.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,17 @@ from seleniumbase import SB
140140
with SB(uc=True, test=True, locale="en", ad_block=True) as sb:
141141
url = "https://www.pokemon.com/us"
142142
sb.activate_cdp_mode(url)
143-
sb.sleep(3.2)
143+
sb.sleep(3.5)
144144
sb.click_if_visible("button#onetrust-accept-btn-handler")
145145
sb.sleep(1.2)
146146
sb.click("a span.icon_pokeball")
147147
sb.sleep(2.5)
148148
sb.click('b:contains("Show Advanced Search")')
149149
sb.sleep(2.5)
150150
sb.click('span[data-type="type"][data-value="electric"]')
151-
sb.sleep(0.5)
151+
sb.sleep(0.7)
152152
sb.scroll_into_view("a#advSearch")
153-
sb.sleep(0.5)
153+
sb.sleep(0.7)
154154
sb.click("a#advSearch")
155155
sb.sleep(1.2)
156156
sb.click('img[src*="img/pokedex/detail/025.png"]')
@@ -234,10 +234,10 @@ with SB(uc=True, test=True, locale="en") as sb:
234234
```python
235235
from seleniumbase import SB
236236

237-
with SB(uc=True, test=True, locale="en", ad_block=True) as sb:
237+
with SB(uc=True, test=True, locale="en", guest=True) as sb:
238238
url = "https://www.bestwestern.com/en_US.html"
239239
sb.activate_cdp_mode(url)
240-
sb.sleep(2.5)
240+
sb.sleep(3)
241241
sb.click_if_visible(".onetrust-close-btn-handler")
242242
sb.sleep(1)
243243
sb.click("input#destination-input")

examples/cdp_mode/raw_ahrefs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
sb.type(input_field, "github.com/seleniumbase/SeleniumBase")
99
sb.scroll_down(36)
1010
sb.click(submit_button)
11-
sb.sleep(1)
11+
sb.sleep(2)
1212
sb.solve_captcha()
1313
sb.sleep(3)
1414
sb.wait_for_text_not_visible("Checking", timeout=15)

examples/cdp_mode/raw_bestwestern.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from seleniumbase import SB
22

3-
with SB(uc=True, test=True, locale="en", ad_block=True) as sb:
3+
with SB(uc=True, test=True, locale="en", guest=True) as sb:
44
url = "https://www.bestwestern.com/en_US.html"
55
sb.activate_cdp_mode(url)
6-
sb.sleep(2.5)
6+
sb.sleep(3)
77
sb.click_if_visible(".onetrust-close-btn-handler")
88
sb.sleep(1)
99
sb.click("input#destination-input")

examples/cdp_mode/raw_cdp_copilot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from seleniumbase import sb_cdp
22

33
url = "https://copilot.microsoft.com/"
4-
sb = sb_cdp.Chrome(url, locale="en")
4+
sb = sb_cdp.Chrome(url, locale="en", guest=True)
55
textarea = "textarea#userInput"
66
sb.wait_for_element(textarea)
77
sb.sleep(1.5)

examples/cdp_mode/raw_cdp_gitlab.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
url = "https://gitlab.com/users/sign_in"
44
sb = sb_cdp.Chrome(url, incognito=True)
5+
sb.sleep(2)
56
sb.solve_captcha()
67
sb.highlight('h1:contains("GitLab")')
78
sb.highlight('button:contains("Sign in")')

examples/cdp_mode/raw_cf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
with SB(uc=True, test=True, locale="en", guest=True) as sb:
55
url = "https://www.cloudflare.com/login"
66
sb.activate_cdp_mode(url)
7-
sb.sleep(3)
7+
sb.sleep(4)
88
sb.uc_gui_handle_captcha() # PyAutoGUI press Tab and Spacebar
99
sb.sleep(2)
1010

1111
with SB(uc=True, test=True, locale="en", guest=True) as sb:
1212
url = "https://www.cloudflare.com/login"
1313
sb.activate_cdp_mode(url)
14-
sb.sleep(3)
14+
sb.sleep(4)
1515
sb.uc_gui_click_captcha() # PyAutoGUI click. (Linux needs it)
1616
sb.sleep(2)

examples/cdp_mode/raw_gitlab.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
with SB(uc=True, test=True, locale="en") as sb:
44
url = "https://gitlab.com/users/sign_in"
55
sb.activate_cdp_mode(url)
6+
sb.sleep(2)
67
sb.solve_captcha()
78
# (The rest is for testing and demo purposes)
89
sb.assert_text("Username", '[for="user_login"]', timeout=3)

examples/cdp_mode/raw_glassdoor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with SB(uc=True, test=True, ad_block=True) as sb:
44
url = "https://www.glassdoor.com/Reviews/index.htm"
55
sb.activate_cdp_mode(url)
6-
sb.sleep(1.2)
6+
sb.sleep(1.5)
77
sb.solve_captcha()
88
sb.highlight('[data-test="global-nav-glassdoor-logo"]')
99
sb.highlight('[data-test="site-header-companies"]')

examples/cdp_mode/raw_kohls.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
from seleniumbase import SB
22

3-
with SB(uc=True, test=True, locale="en", ad_block=True) as sb:
3+
with SB(uc=True, test=True, locale="en", incognito=True) as sb:
44
url = "https://www.kohls.com/"
55
sb.activate_cdp_mode(url)
66
sb.sleep(2.6)
77
search = "Mickey Mouse Blanket"
88
req_1 = "Mickey"
99
req_2 = "Blanket"
10+
if not sb.is_element_present('input[name="search"]'):
11+
sb.refresh()
12+
sb.sleep(2.6)
1013
sb.press_keys('input[name="search"]', search + "\n")
1114
sb.sleep(5)
1215
item_selector = 'div[data-testid*="wallet-wrapper"]'

0 commit comments

Comments
 (0)