seleniumbase 4.40.1__py3-none-any.whl → 4.40.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sbase/steps.py CHANGED
@@ -1191,6 +1191,15 @@ def set_attributes(context, selector, attribute, value):
1191
1191
  sb.set_attributes(selector, attribute, value)
1192
1192
 
1193
1193
 
1194
+ @step("Save page source to logs")
1195
+ @step("Save the page source to the logs")
1196
+ @step("User saves page source to logs")
1197
+ @step("User saves the page source to the logs")
1198
+ def save_page_source_to_logs(context):
1199
+ sb = context.sb
1200
+ sb.save_page_source_to_logs()
1201
+
1202
+
1194
1203
  @step("Activate CDP Mode")
1195
1204
  @step("User activates CDP Mode")
1196
1205
  def activate_cdp_mode(context):
@@ -1,2 +1,2 @@
1
1
  # seleniumbase package
2
- __version__ = "4.40.1"
2
+ __version__ = "4.40.3"
@@ -522,6 +522,8 @@ def generate_gherkin(srt_actions):
522
522
  )
523
523
  elif action[0] == "ss_tl":
524
524
  sb_actions.append("Save screenshot to logs")
525
+ elif action[0] == "spstl":
526
+ sb_actions.append("Save page source to logs")
525
527
  elif action[0] == "sh_fc":
526
528
  sb_actions.append("Show file choosers")
527
529
  elif action[0] == "pr_da":
@@ -556,6 +556,9 @@ def generate_sbase_code(srt_actions):
556
556
  elif action[0] == "ss_tl":
557
557
  method = "save_screenshot_to_logs"
558
558
  sb_actions.append("self.%s()" % method)
559
+ elif action[0] == "spstl":
560
+ method = "save_page_source_to_logs"
561
+ sb_actions.append("self.%s()" % method)
559
562
  elif action[0] == "sh_fc":
560
563
  method = "show_file_choosers"
561
564
  sb_actions.append("self.%s()" % method)
@@ -132,6 +132,7 @@ class BaseCase(unittest.TestCase):
132
132
  self.__called_teardown = False
133
133
  self.__start_time_ms = int(time.time() * 1000.0)
134
134
  self.__requests_timeout = None
135
+ self.__page_source_count = 0
135
136
  self.__screenshot_count = 0
136
137
  self.__logs_data_count = 0
137
138
  self.__last_data_file = None
@@ -3590,7 +3591,7 @@ class BaseCase(unittest.TestCase):
3590
3591
  self.set_window_rect(x, y, width, height)
3591
3592
  self.__demo_mode_pause_if_active(tiny=True)
3592
3593
 
3593
- def switch_to_frame(self, frame="iframe", timeout=None):
3594
+ def switch_to_frame(self, frame="iframe", timeout=None, invisible=False):
3594
3595
  """Wait for an iframe to appear, and switch to it. This should be
3595
3596
  usable as a drop-in replacement for driver.switch_to.frame().
3596
3597
  The iframe identifier can be a selector, an index, an id, a name,
@@ -3598,7 +3599,8 @@ class BaseCase(unittest.TestCase):
3598
3599
  for visible iframes with a string selector.
3599
3600
  @Params
3600
3601
  frame - the frame element, name, id, index, or selector
3601
- timeout - the time to wait for the alert in seconds """
3602
+ timeout - the time to wait for the alert in seconds
3603
+ invisible - if True, the iframe can be invisible """
3602
3604
  self.__check_scope()
3603
3605
  if not timeout:
3604
3606
  timeout = settings.LARGE_TIMEOUT
@@ -3648,7 +3650,9 @@ class BaseCase(unittest.TestCase):
3648
3650
  time.sleep(0.035)
3649
3651
  if self.undetectable:
3650
3652
  time.sleep(0.035)
3651
- page_actions.switch_to_frame(self.driver, frame, timeout)
3653
+ page_actions.switch_to_frame(
3654
+ self.driver, frame, timeout, invisible=invisible
3655
+ )
3652
3656
  self.wait_for_ready_state_complete()
3653
3657
  if self.__needs_minimum_wait():
3654
3658
  time.sleep(0.015)
@@ -4512,6 +4516,40 @@ class BaseCase(unittest.TestCase):
4512
4516
  sb_config._has_logs = True
4513
4517
  return page_actions.save_screenshot(self.driver, name, test_logpath)
4514
4518
 
4519
+ def save_page_source_to_logs(self, name=None):
4520
+ """Saves the page HTML to the "latest_logs/" folder.
4521
+ Naming is automatic:
4522
+ If NO NAME provided: "_1_source.html", "_2_source.html", etc.
4523
+ If NAME IS provided, then: "_1_name.html", "_2_name.html", etc.
4524
+ (The last_page / failure page_source is always "page_source.html")"""
4525
+ if not self.__is_cdp_swap_needed():
4526
+ self.wait_for_ready_state_complete()
4527
+ test_logpath = os.path.join(self.log_path, self.__get_test_id())
4528
+ self.__create_log_path_as_needed(test_logpath)
4529
+ if name:
4530
+ name = str(name)
4531
+ self.__page_source_count += 1
4532
+ if not name or len(name) == 0:
4533
+ name = "_%s_source.html" % self.__page_source_count
4534
+ else:
4535
+ pre_name = "_%s_" % self.__page_source_count
4536
+ if len(name) >= 4 and name[-4:].lower() == ".html":
4537
+ name = name[:-4]
4538
+ if len(name) == 0:
4539
+ name = "source"
4540
+ name = "%s%s.html" % (pre_name, name)
4541
+ if self.recorder_mode:
4542
+ url = self.get_current_url()
4543
+ if url and len(url) > 0:
4544
+ if ("http:") in url or ("https:") in url or ("file:") in url:
4545
+ if self.get_session_storage_item("pause_recorder") == "no":
4546
+ time_stamp = self.execute_script("return Date.now();")
4547
+ origin = self.get_origin()
4548
+ action = ["spstl", "", origin, time_stamp]
4549
+ self.__extra_actions.append(action)
4550
+ sb_config._has_logs = True
4551
+ return page_actions.save_page_source(self.driver, name, test_logpath)
4552
+
4515
4553
  def save_data_to_logs(self, data, file_name=None):
4516
4554
  """Saves data to the "latest_logs/" data folder of the current test.
4517
4555
  If no file_name, file_name becomes: "data_1.txt", "data_2.txt", etc.
@@ -5470,6 +5508,7 @@ class BaseCase(unittest.TestCase):
5470
5508
  ext_actions.append("s_scr")
5471
5509
  ext_actions.append("ss_tf")
5472
5510
  ext_actions.append("ss_tl")
5511
+ ext_actions.append("spstl")
5473
5512
  ext_actions.append("da_el")
5474
5513
  ext_actions.append("da_ep")
5475
5514
  ext_actions.append("da_te")
@@ -1572,7 +1572,9 @@ def wait_for_and_switch_to_alert(driver, timeout=settings.LARGE_TIMEOUT):
1572
1572
  timeout_exception(Exception, message)
1573
1573
 
1574
1574
 
1575
- def switch_to_frame(driver, frame, timeout=settings.SMALL_TIMEOUT):
1575
+ def switch_to_frame(
1576
+ driver, frame, timeout=settings.SMALL_TIMEOUT, invisible=False
1577
+ ):
1576
1578
  """
1577
1579
  Wait for an iframe to appear, and switch to it. This should be
1578
1580
  usable as a drop-in replacement for driver.switch_to.frame().
@@ -1580,6 +1582,7 @@ def switch_to_frame(driver, frame, timeout=settings.SMALL_TIMEOUT):
1580
1582
  driver - the webdriver object (required)
1581
1583
  frame - the frame element, name, id, index, or selector
1582
1584
  timeout - the time to wait for the alert in seconds
1585
+ invisible - if True, the iframe can be invisible
1583
1586
  """
1584
1587
  _reconnect_if_disconnected(driver)
1585
1588
  start_ms = time.time() * 1000.0
@@ -1596,7 +1599,10 @@ def switch_to_frame(driver, frame, timeout=settings.SMALL_TIMEOUT):
1596
1599
  by = "xpath"
1597
1600
  else:
1598
1601
  by = "css selector"
1599
- if is_element_visible(driver, frame, by=by):
1602
+ if (
1603
+ is_element_visible(driver, frame, by=by)
1604
+ or (invisible and is_element_present(driver, frame, by=by))
1605
+ ):
1600
1606
  with suppress(Exception):
1601
1607
  element = driver.find_element(by=by, value=frame)
1602
1608
  driver.switch_to.frame(element)
@@ -1608,8 +1614,12 @@ def switch_to_frame(driver, frame, timeout=settings.SMALL_TIMEOUT):
1608
1614
  plural = "s"
1609
1615
  if timeout == 1:
1610
1616
  plural = ""
1611
- message = "Frame {%s} was not visible after %s second%s!" % (
1617
+ presence = "visible"
1618
+ if invisible:
1619
+ presence = "present"
1620
+ message = "Frame {%s} was not %s after %s second%s!" % (
1612
1621
  frame,
1622
+ presence,
1613
1623
  timeout,
1614
1624
  plural,
1615
1625
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seleniumbase
3
- Version: 4.40.1
3
+ Version: 4.40.3
4
4
  Summary: A complete web automation framework for end-to-end testing.
5
5
  Home-page: https://github.com/seleniumbase/SeleniumBase
6
6
  Author: Michael Mintz
@@ -67,7 +67,7 @@ Requires-Dist: setuptools~=70.2; python_version < "3.10"
67
67
  Requires-Dist: setuptools>=80.9.0; python_version >= "3.10"
68
68
  Requires-Dist: wheel>=0.45.1
69
69
  Requires-Dist: attrs>=25.3.0
70
- Requires-Dist: certifi>=2025.6.15
70
+ Requires-Dist: certifi>=2025.7.9
71
71
  Requires-Dist: exceptiongroup>=1.3.0
72
72
  Requires-Dist: websockets~=13.1; python_version < "3.9"
73
73
  Requires-Dist: websockets>=15.0.1; python_version >= "3.9"
@@ -108,7 +108,7 @@ Requires-Dist: wsproto==1.2.0
108
108
  Requires-Dist: websocket-client==1.8.0
109
109
  Requires-Dist: selenium==4.27.1; python_version < "3.9"
110
110
  Requires-Dist: selenium==4.32.0; python_version >= "3.9" and python_version < "3.10"
111
- Requires-Dist: selenium==4.34.1; python_version >= "3.10"
111
+ Requires-Dist: selenium==4.34.2; python_version >= "3.10"
112
112
  Requires-Dist: cssselect==1.2.0; python_version < "3.9"
113
113
  Requires-Dist: cssselect==1.3.0; python_version >= "3.9"
114
114
  Requires-Dist: sortedcontainers==2.4.0
@@ -1,11 +1,11 @@
1
1
  sbase/__init__.py,sha256=02izDj786GVBT0bpSq2Q2O8uwSxtyT09pnobZz91ML8,605
2
2
  sbase/__main__.py,sha256=G0bVB1-DM4PGwQ1KyOupaWCs4ePbChZNNWuX2htim5U,647
3
- sbase/steps.py,sha256=_WvAjydKqZfTdnZW9LPKkRty-g-lfdUPmLqnZj6ulcs,43013
3
+ sbase/steps.py,sha256=EdJyNVJ1yxoHsc7qp8kzx0EESIkOh_033yLCvmaPcs4,43281
4
4
  seleniumbase/__init__.py,sha256=JFEY9P5QJqsa1M6ghzLMH2eIPQyh85iglCaQwg8Y8z4,2498
5
5
  seleniumbase/__main__.py,sha256=dn1p6dgCchmcH1zzTzzQvFwwdQQqnTGH6ULV9m4hv24,654
6
- seleniumbase/__version__.py,sha256=-yI_EbTAoSA-4bx2PJ3MMzIxhYRoE314euG41GQuyRg,46
6
+ seleniumbase/__version__.py,sha256=6jQcUCtLJbgco1ARBRYHuIHXig8TBijTdYXDGLd4ERA,46
7
7
  seleniumbase/behave/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- seleniumbase/behave/behave_helper.py,sha256=elkl8P9eLulRAioLstE9baYNM9N_PHBmAOcajX-pH_Y,24198
8
+ seleniumbase/behave/behave_helper.py,sha256=f4CdiSSYM3gMAicSKWJInkVGFwpGXtHMD8fikTehopQ,24291
9
9
  seleniumbase/behave/behave_sb.py,sha256=guLihFsr1uJ4v2AR3r3Vy_BTeHrHwy2JEJxhp-MVnZA,59872
10
10
  seleniumbase/behave/steps.py,sha256=8-N-NB2tnDsxaP4LSg-uSBgbwZYMS6ZEL1oggO1PCoU,390
11
11
  seleniumbase/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -47,7 +47,7 @@ seleniumbase/core/jqc_helper.py,sha256=2DDQr9Q2jSSZqFzX588jLlUM9oJvyrRWq2aORSIPU
47
47
  seleniumbase/core/log_helper.py,sha256=JvB3FyOJJkVAP5RZXUuap468LIacqlO1UsqtEAVTfG4,23612
48
48
  seleniumbase/core/mysql.py,sha256=X1McqBWCzN9DndyBbNrVg9_kvtaByVhodiXYkGbn36A,3955
49
49
  seleniumbase/core/proxy_helper.py,sha256=pZ1NboNfziHU3vWZLOZLX-qkfM3oKSnpc3omQf9EUQQ,8809
50
- seleniumbase/core/recorder_helper.py,sha256=fNGjbapXmEsht54x1o6Igk198QdnPxDDnjUOzQxNhNQ,25055
50
+ seleniumbase/core/recorder_helper.py,sha256=OBqNiCC_11ctpsD72KV4YUaKovmSpvs14HP1gwFesBA,25190
51
51
  seleniumbase/core/report_helper.py,sha256=AIl6Qava2yW1uSzbLpJBlPlYDz0KE-rVhogh8hsGWBo,12201
52
52
  seleniumbase/core/s3_manager.py,sha256=z_4qx2jI_gtK5r3niGXgEOBpfMUicUCOciowai50MP4,3529
53
53
  seleniumbase/core/sb_cdp.py,sha256=2KYfNQQBjUa_o2oMaGlzmHpGuvz-SJ9baGfxVyjOCSM,94104
@@ -67,12 +67,12 @@ seleniumbase/extensions/disable_csp.zip,sha256=5RvomXnm2PdivUVcxTV6jfvD8WhTEsQYH
67
67
  seleniumbase/extensions/recorder.zip,sha256=JEE_FVEvlS63cFQbVLEroIyPSS91nWCDL0MhjVrmIpk,11813
68
68
  seleniumbase/extensions/sbase_ext.zip,sha256=3s1N8zrVaMz8RQEOIoBzC3KDjtmHwVZRvVsX25Odr_s,8175
69
69
  seleniumbase/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
- seleniumbase/fixtures/base_case.py,sha256=ub5qfdUW046h1p24C3JVWtf7wQPLfHscD39HuHez0ys,735066
70
+ seleniumbase/fixtures/base_case.py,sha256=V2qjsxtpJhKqmtAN6QhIKlAZMRIyDcI1thF0bcxYtuE,736960
71
71
  seleniumbase/fixtures/constants.py,sha256=WMrItuNyKq3XVJ64NluLIRc4gJCxDw8K8qXED0b9S2w,13752
72
72
  seleniumbase/fixtures/css_to_xpath.py,sha256=9ouDB1xl4MJ2os6JOgTIAyHKOQfuxtxvXC3O5hSnEKA,1954
73
73
  seleniumbase/fixtures/errors.py,sha256=KyxuEVx_e3MPhVrJfNIa_3ltMpbCFxfy_jxK8RFNTns,555
74
74
  seleniumbase/fixtures/js_utils.py,sha256=Ykt019DFP8S27o8Kai_ihT01qQWo3RqHUeljqOEUdFU,52247
75
- seleniumbase/fixtures/page_actions.py,sha256=55FUYDkgdIjMOo54oCf3BXr0ZpVX48tAteWfM0GcX4o,72114
75
+ seleniumbase/fixtures/page_actions.py,sha256=pFhFMc0EZ9kdWR68t669aW7bRuH2hSVZuC1iI_4XVHE,72395
76
76
  seleniumbase/fixtures/page_utils.py,sha256=H1iV8f9vDyEy87DBntyiBXC_tg8HskcebUOAJVn0hxE,12160
77
77
  seleniumbase/fixtures/shared_utils.py,sha256=G6CsE-Adt-GfuZF-71jXWKSIQW7YZPx8FIM24pVd_yI,8368
78
78
  seleniumbase/fixtures/unittest_helper.py,sha256=sfZ92rZeBAn_sF_yQ3I6_I7h3lyU5-cV_UMegBNoEm8,1294
@@ -137,9 +137,9 @@ seleniumbase/utilities/selenium_grid/start-grid-hub.bat,sha256=Ftq-GrAKRYH2ssDPr
137
137
  seleniumbase/utilities/selenium_grid/start-grid-hub.sh,sha256=KADv0RUHONLL2_I443QFK8PryBpDmKn5Gy0s4o0vDSM,106
138
138
  seleniumbase/utilities/selenium_ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
139
139
  seleniumbase/utilities/selenium_ide/convert_ide.py,sha256=pZFnqEJQEKZPyNFjkLD29s2HPQgCrWW9XJWpCPhWOoM,31691
140
- seleniumbase-4.40.1.dist-info/licenses/LICENSE,sha256=BRblZsX7HyPUjQmYTiyWr_e9tzWvmR3R4SFclM2R3W0,1085
141
- seleniumbase-4.40.1.dist-info/METADATA,sha256=uBB3zk9j5RzNQikjWZtVebswfSe5W1SYxsegKY9TBaA,87295
142
- seleniumbase-4.40.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
143
- seleniumbase-4.40.1.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
144
- seleniumbase-4.40.1.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
145
- seleniumbase-4.40.1.dist-info/RECORD,,
140
+ seleniumbase-4.40.3.dist-info/licenses/LICENSE,sha256=BRblZsX7HyPUjQmYTiyWr_e9tzWvmR3R4SFclM2R3W0,1085
141
+ seleniumbase-4.40.3.dist-info/METADATA,sha256=ZcQxnIRpNtv7tX84C27E3W22hNtRZ6HKGLuig4S71N8,87294
142
+ seleniumbase-4.40.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
143
+ seleniumbase-4.40.3.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
144
+ seleniumbase-4.40.3.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
145
+ seleniumbase-4.40.3.dist-info/RECORD,,