Skip to content

Commit c9b4504

Browse files
authored
Merge pull request #4385 from seleniumbase/cdp-mode-patch-115
CDP Mode: Patch 115
2 parents 8204d89 + daefe6f commit c9b4504

8 files changed

Lines changed: 59 additions & 18 deletions

File tree

examples/cdp_mode/raw_homedepot.py

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

3-
with SB(uc=True, test=True, incognito=True) as sb:
3+
with SB(uc=True, test=True, guest=True) as sb:
44
sb.activate_cdp_mode()
55
sb.goto("https://www.homedepot.com/")
66
sb.sleep(1.5)

examples/cdp_mode/raw_iphey.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from seleniumbase import SB
2+
3+
with SB(uc=True, test=True, guest=True) as sb:
4+
sb.activate_cdp_mode()
5+
sb.goto("https://iphey.com")
6+
sb.sleep(7)
7+
trustworthy = "#hero-status"
8+
sb.assert_element(trustworthy)
9+
sb.assert_text("Trustworthy", trustworthy)
10+
sb.highlight(trustworthy, loops=10, scroll=False)
11+
items = sb.find_elements('a[style*="check-circle"]')
12+
sb.assert_true(len(items) == 5, "Expecting 5 checks!")
13+
for item in items:
14+
item.flash(color="44CC88")
15+
sb.sleep(0.2)
16+
sb.sleep(2)
17+
sb.save_screenshot_to_logs()

examples/cdp_mode/raw_priceline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
input_selector = 'input[name="endLocation"]'
99
if not sb.is_element_present(input_selector):
1010
input_selector = "div.location-input input"
11-
sb.click(input_selector)
12-
sb.sleep(1.2)
11+
sb.mouse_click(input_selector)
12+
sb.sleep(0.5)
1313
location = "Portland, OR"
1414
selection = "Oregon, United States" # (Dropdown option)
15-
sb.type(input_selector, location)
15+
sb.press_keys(input_selector, location)
1616
sb.sleep(0.5)
1717
sb.click(selection)
1818
sb.sleep(0.4)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ websockets>=16.0;python_version>="3.10"
1212
filelock~=3.19.1;python_version<"3.10"
1313
filelock>=3.29.3;python_version>="3.10"
1414
fasteners>=0.20
15-
mycdp>=1.3.7
15+
mycdp>=1.4.0
1616
pynose>=1.5.5
1717
platformdirs~=4.4.0;python_version<"3.10"
1818
platformdirs>=4.10.0;python_version>="3.10"

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.49.10"
2+
__version__ = "4.49.11"

seleniumbase/core/sb_cdp.py

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,7 +3338,7 @@ def assert_text_not_visible(self, text, selector="body", timeout=None):
33383338
def assert_true(self, expression, msg=None):
33393339
if not expression:
33403340
if not msg:
3341-
raise AssertionError("%s is not true" % expression)
3341+
raise AssertionError("%s is not true." % expression)
33423342
else:
33433343
raise AssertionError(
33443344
"%s is not true. (%s)" % (expression, msg)
@@ -3347,27 +3347,48 @@ def assert_true(self, expression, msg=None):
33473347
def assert_false(self, expression, msg=None):
33483348
if expression:
33493349
if not msg:
3350-
raise AssertionError("%s is not false" % expression)
3350+
raise AssertionError("%s is not false." % expression)
33513351
else:
33523352
raise AssertionError(
33533353
"%s is not false. (%s)" % (expression, msg)
33543354
)
33553355

3356-
def assert_equal(self, first, second):
3356+
def assert_equal(self, first, second, msg=None):
33573357
if first != second:
3358-
raise AssertionError("%s is not equal to %s" % (first, second))
3358+
if not msg:
3359+
raise AssertionError(
3360+
"%s is not equal to %s." % (first, second)
3361+
)
3362+
else:
3363+
raise AssertionError(
3364+
"%s is not equal to %s. (%s)" % (first, second, msg))
33593365

3360-
def assert_not_equal(self, first, second):
3366+
def assert_not_equal(self, first, second, msg=None):
33613367
if first == second:
3362-
raise AssertionError("%s is equal to %s" % (first, second))
3368+
if not msg:
3369+
raise AssertionError("%s is equal to %s." % (first, second))
3370+
else:
3371+
raise AssertionError(
3372+
"%s is equal to %s. (%s)" % (first, second, msg)
3373+
)
33633374

3364-
def assert_in(self, first, second):
3375+
def assert_in(self, first, second, msg=None):
33653376
if first not in second:
3366-
raise AssertionError("%s is not in %s" % (first, second))
3377+
if not msg:
3378+
raise AssertionError("%s is not in %s." % (first, second))
3379+
else:
3380+
raise AssertionError(
3381+
"%s is not in %s. (%s)" % (first, second, msg)
3382+
)
33673383

3368-
def assert_not_in(self, first, second):
3384+
def assert_not_in(self, first, second, msg=None):
33693385
if first in second:
3370-
raise AssertionError("%s is in %s" % (first, second))
3386+
if not msg:
3387+
raise AssertionError("%s is in %s." % (first, second))
3388+
else:
3389+
raise AssertionError(
3390+
"%s is in %s. (%s)" % (first, second, msg)
3391+
)
33713392

33723393
def js_scroll_into_view(self, selector):
33733394
css_selector = self.__convert_to_css_if_xpath(selector)

seleniumbase/undetected/cdp_driver/browser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ async def get(
501501
"*.ad.gt*",
502502
]
503503
))
504+
time.sleep(0.02)
505+
self.wait(0.02)
506+
await connection.sleep(0.03)
504507
if _cdp_geolocation:
505508
await connection.set_geolocation(_cdp_geolocation)
506509
if _cdp_disable_csp:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
'filelock~=3.19.1;python_version<"3.10"',
177177
'filelock>=3.29.3;python_version>="3.10"',
178178
'fasteners>=0.20',
179-
'mycdp>=1.3.7',
179+
'mycdp>=1.4.0',
180180
'pynose>=1.5.5',
181181
'platformdirs~=4.4.0;python_version<"3.10"',
182182
'platformdirs>=4.10.0;python_version>="3.10"',
@@ -273,7 +273,7 @@
273273
"pdfminer": [
274274
'pdfminer.six==20251107;python_version<"3.10"',
275275
'pdfminer.six==20260107;python_version>="3.10"',
276-
'cryptography==48.0.1',
276+
'cryptography==49.0.0',
277277
'cffi==2.0.0',
278278
'pycparser==2.23;python_version<"3.10"',
279279
'pycparser==3.0;python_version>="3.10"',

0 commit comments

Comments
 (0)