Skip to content

Commit 069b416

Browse files
committed
Do some refactoring
1 parent c03d1ec commit 069b416

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,7 @@ def click(
355355
if self.__is_shadow_selector(selector):
356356
self.__shadow_click(selector, timeout)
357357
return
358-
if self.browser == "safari":
359-
self.wait_for_ready_state_complete()
360-
if self.__needs_minimum_wait():
358+
if self.__needs_minimum_wait() or self.browser == "safari":
361359
time.sleep(0.022)
362360
element = page_actions.wait_for_element_visible(
363361
self.driver,
@@ -374,9 +372,7 @@ def click(
374372
try:
375373
if (
376374
by == By.LINK_TEXT
377-
and (
378-
self.browser == "ie" or self.browser == "safari"
379-
)
375+
and (self.browser == "ie" or self.browser == "safari")
380376
):
381377
self.__jquery_click(selector, by=by)
382378
else:
@@ -598,8 +594,6 @@ def click(
598594
self.__demo_mode_pause_if_active(tiny=True)
599595
elif self.slow_mode:
600596
self.__slow_mode_pause_if_active()
601-
elif self.browser == "safari":
602-
self.wait_for_ready_state_complete()
603597

604598
def slow_click(self, selector, by="css selector", timeout=None):
605599
"""Similar to click(), but pauses for a brief moment before clicking.
@@ -2969,7 +2963,7 @@ def load_html_string(self, html_string, new_page=True):
29692963
html_string = html_string.replace("\\ ", " ")
29702964

29712965
if new_page:
2972-
self.open("data:text/html,<head></head><body></body>")
2966+
self.open("data:text/html,<head></head><body><div></div></body>")
29732967
inner_head = """document.getElementsByTagName("head")[0].innerHTML"""
29742968
inner_body = """document.getElementsByTagName("body")[0].innerHTML"""
29752969
try:
@@ -3011,8 +3005,7 @@ def load_html_file(self, html_file, new_page=True):
30113005
"""Loads a local html file into the browser from a relative file path.
30123006
If new_page==True, the page will switch to: "data:text/html,"
30133007
If new_page==False, will load HTML into the current page.
3014-
Local images and other local src content WILL BE IGNORED.
3015-
"""
3008+
Local images and other local src content WILL BE IGNORED."""
30163009
self.__check_scope()
30173010
if self.__looks_like_a_page_url(html_file):
30183011
self.open(html_file)
@@ -3032,8 +3025,7 @@ def load_html_file(self, html_file, new_page=True):
30323025

30333026
def open_html_file(self, html_file):
30343027
"""Opens a local html file into the browser from a relative file path.
3035-
The URL displayed in the web browser will start with "file://".
3036-
"""
3028+
The URL displayed in the web browser will start with "file://"."""
30373029
self.__check_scope()
30383030
if self.__looks_like_a_page_url(html_file):
30393031
self.open(html_file)

0 commit comments

Comments
 (0)