@@ -2004,6 +2004,7 @@ def hover_and_click(
2004
2004
)
2005
2005
hover_selector = self.convert_to_css_selector(hover_selector, hover_by)
2006
2006
hover_by = By.CSS_SELECTOR
2007
+ original_click_selector = click_selector
2007
2008
click_selector, click_by = self.__recalculate_selector(
2008
2009
click_selector, click_by
2009
2010
)
@@ -2019,6 +2020,10 @@ def hover_and_click(
2019
2020
if url and len(url) > 0:
2020
2021
if ("http:") in url or ("https:") in url or ("file:") in url:
2021
2022
if self.get_session_storage_item("pause_recorder") == "no":
2023
+ if hover_by == By.XPATH:
2024
+ hover_selector = original_selector
2025
+ if click_by == By.XPATH:
2026
+ click_selector = original_click_selector
2022
2027
time_stamp = self.execute_script("return Date.now();")
2023
2028
origin = self.get_origin()
2024
2029
the_selectors = [hover_selector, click_selector]
@@ -9506,6 +9511,7 @@ def assert_element(self, selector, by=By.CSS_SELECTOR, timeout=None):
9506
9511
self.__assert_shadow_element_visible(selector)
9507
9512
return True
9508
9513
self.wait_for_element_visible(selector, by=by, timeout=timeout)
9514
+ original_selector = selector
9509
9515
if self.demo_mode:
9510
9516
selector, by = self.__recalculate_selector(
9511
9517
selector, by, xp_ok=False
@@ -9522,6 +9528,8 @@ def assert_element(self, selector, by=By.CSS_SELECTOR, timeout=None):
9522
9528
if url and len(url) > 0:
9523
9529
if ("http:") in url or ("https:") in url or ("file:") in url:
9524
9530
if self.get_session_storage_item("pause_recorder") == "no":
9531
+ if by == By.XPATH:
9532
+ selector = original_selector
9525
9533
time_stamp = self.execute_script("return Date.now();")
9526
9534
origin = self.get_origin()
9527
9535
action = ["as_el", selector, origin, time_stamp]
@@ -9689,6 +9697,7 @@ def assert_text(
9689
9697
timeout = settings.SMALL_TIMEOUT
9690
9698
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
9691
9699
timeout = self.__get_new_timeout(timeout)
9700
+ original_selector = selector
9692
9701
selector, by = self.__recalculate_selector(selector, by)
9693
9702
if self.__is_shadow_selector(selector):
9694
9703
self.__assert_shadow_text_visible(text, selector, timeout)
@@ -9715,6 +9724,8 @@ def assert_text(
9715
9724
if url and len(url) > 0:
9716
9725
if ("http:") in url or ("https:") in url or ("file:") in url:
9717
9726
if self.get_session_storage_item("pause_recorder") == "no":
9727
+ if by == By.XPATH:
9728
+ selector = original_selector
9718
9729
time_stamp = self.execute_script("return Date.now();")
9719
9730
origin = self.get_origin()
9720
9731
text_selector = [text, selector]
@@ -9735,6 +9746,7 @@ def assert_exact_text(
9735
9746
timeout = settings.SMALL_TIMEOUT
9736
9747
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
9737
9748
timeout = self.__get_new_timeout(timeout)
9749
+ original_selector = selector
9738
9750
selector, by = self.__recalculate_selector(selector, by)
9739
9751
if self.__is_shadow_selector(selector):
9740
9752
self.__assert_exact_shadow_text_visible(text, selector, timeout)
@@ -9763,6 +9775,8 @@ def assert_exact_text(
9763
9775
if url and len(url) > 0:
9764
9776
if ("http:") in url or ("https:") in url or ("file:") in url:
9765
9777
if self.get_session_storage_item("pause_recorder") == "no":
9778
+ if by == By.XPATH:
9779
+ selector = original_selector
9766
9780
time_stamp = self.execute_script("return Date.now();")
9767
9781
origin = self.get_origin()
9768
9782
text_selector = [text, selector]
@@ -10001,12 +10015,16 @@ def assert_element_not_visible(
10001
10015
timeout = settings.SMALL_TIMEOUT
10002
10016
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
10003
10017
timeout = self.__get_new_timeout(timeout)
10018
+ original_selector = selector
10019
+ selector, by = self.__recalculate_selector(selector, by)
10004
10020
self.wait_for_element_not_visible(selector, by=by, timeout=timeout)
10005
10021
if self.recorder_mode:
10006
10022
url = self.get_current_url()
10007
10023
if url and len(url) > 0:
10008
10024
if ("http:") in url or ("https:") in url or ("file:") in url:
10009
10025
if self.get_session_storage_item("pause_recorder") == "no":
10026
+ if by == By.XPATH:
10027
+ selector = original_selector
10010
10028
time_stamp = self.execute_script("return Date.now();")
10011
10029
origin = self.get_origin()
10012
10030
action = ["asenv", selector, origin, time_stamp]
@@ -11437,12 +11455,13 @@ def setUp(self, masterqa_mode=False):
11437
11455
# This raises an exception if the test is not coming from pytest
11438
11456
self.is_pytest = sb_config.is_pytest
11439
11457
except Exception:
11440
- # Not using pytest (probably nosetests)
11458
+ # Not using pytest (could be nosetests, behave, or raw Python )
11441
11459
self.is_pytest = False
11442
11460
if self.is_pytest:
11443
11461
# pytest-specific code
11444
11462
test_id = self.__get_test_id()
11445
11463
self.test_id = test_id
11464
+ self.is_behave = False
11446
11465
if hasattr(self, "_using_sb_fixture"):
11447
11466
self.test_id = sb_config._test_id
11448
11467
if hasattr(sb_config, "_sb_pdb_driver"):
@@ -11589,7 +11608,7 @@ def setUp(self, masterqa_mode=False):
11589
11608
self.testcase_manager = TestcaseManager(self.database_env)
11590
11609
#
11591
11610
exec_payload = ExecutionQueryPayload()
11592
- exec_payload.execution_start_time = int(time.time() * 1000)
11611
+ exec_payload.execution_start_time = int(time.time() * 1000.0 )
11593
11612
self.execution_start_time = exec_payload.execution_start_time
11594
11613
exec_payload.guid = self.execution_guid
11595
11614
exec_payload.username = getpass.getuser()
@@ -11833,9 +11852,7 @@ def setUp(self, masterqa_mode=False):
11833
11852
# Although the pytest clock starts before setUp() begins,
11834
11853
# the time-limit clock starts at the end of the setUp() method.
11835
11854
sb_config.start_time_ms = int(time.time() * 1000.0)
11836
- if not self.__start_time_ms:
11837
- # Call this once in case of multiple setUp() calls in the same test
11838
- self.__start_time_ms = sb_config.start_time_ms
11855
+ self.__start_time_ms = sb_config.start_time_ms
11839
11856
11840
11857
def __set_last_page_screenshot(self):
11841
11858
"""self.__last_page_screenshot is only for pytest html report logs.
@@ -11917,7 +11934,7 @@ def __insert_test_result(self, state, err):
11917
11934
from seleniumbase.core.testcase_manager import TestcaseDataPayload
11918
11935
11919
11936
data_payload = TestcaseDataPayload()
11920
- data_payload.runtime = int(time.time() * 1000) - self.case_start_time
11937
+ data_payload.runtime = int(time.time() * 1000.0 ) - self.case_start_time
11921
11938
data_payload.guid = self.testcase_guid
11922
11939
data_payload.execution_guid = self.execution_guid
11923
11940
data_payload.state = state
@@ -12186,7 +12203,7 @@ def __process_dashboard(self, has_exception, init=False):
12186
12203
if hasattr(self, "_using_sb_fixture") and self.__will_be_skipped:
12187
12204
test_id = sb_config._test_id
12188
12205
if not init:
12189
- duration_ms = int(time.time() * 1000) - self.__start_time_ms
12206
+ duration_ms = int(time.time() * 1000.0 ) - self.__start_time_ms
12190
12207
duration = float(duration_ms) / 1000.0
12191
12208
duration = "{:.2f}".format(duration)
12192
12209
sb_config._duration[test_id] = duration
@@ -12707,7 +12724,7 @@ def tearDown(self):
12707
12724
self.__insert_test_result(
12708
12725
constants.State.PASSED, False
12709
12726
)
12710
- runtime = int(time.time() * 1000) - self.execution_start_time
12727
+ runtime = int(time.time() * 1000.0 ) - self.execution_start_time
12711
12728
self.testcase_manager.update_execution_data(
12712
12729
self.execution_guid, runtime
12713
12730
)
0 commit comments