@@ -44,6 +44,7 @@ def test_anything(self):
44
44
ElementClickInterceptedException as ECI_Exception,
45
45
ElementNotInteractableException as ENI_Exception,
46
46
MoveTargetOutOfBoundsException,
47
+ NoSuchElementException,
47
48
NoSuchWindowException,
48
49
StaleElementReferenceException,
49
50
WebDriverException,
@@ -364,6 +365,8 @@ def click(
364
365
self.wait_for_angularjs(timeout=settings.MINI_TIMEOUT)
365
366
if self.driver.current_url != pre_action_url:
366
367
self.__ad_block_as_needed()
368
+ if self.browser == "safari":
369
+ time.sleep(0.02)
367
370
if self.demo_mode:
368
371
if self.driver.current_url != pre_action_url:
369
372
self.__demo_mode_pause_if_active()
@@ -4866,14 +4869,26 @@ def choose_file(
4866
4869
if type(abs_path) is int or type(abs_path) is float:
4867
4870
abs_path = str(abs_path)
4868
4871
try:
4869
- element.send_keys(abs_path)
4872
+ if self.browser == "safari":
4873
+ try:
4874
+ element.send_keys(abs_path)
4875
+ except NoSuchElementException:
4876
+ pass # May get this error on Safari even if upload works.
4877
+ else:
4878
+ element.send_keys(abs_path)
4870
4879
except (StaleElementReferenceException, ENI_Exception):
4871
4880
self.wait_for_ready_state_complete()
4872
4881
time.sleep(0.16)
4873
4882
element = self.wait_for_element_present(
4874
4883
selector, by=by, timeout=timeout
4875
4884
)
4876
- element.send_keys(abs_path)
4885
+ if self.browser == "safari":
4886
+ try:
4887
+ element.send_keys(abs_path)
4888
+ except NoSuchElementException:
4889
+ pass # May get this error on Safari even if upload works.
4890
+ else:
4891
+ element.send_keys(abs_path)
4877
4892
if self.demo_mode:
4878
4893
if self.driver.current_url != pre_action_url:
4879
4894
self.__demo_mode_pause_if_active()
0 commit comments