Skip to content

Commit 5785a21

Browse files
committed
Move deprecated methods to their own section
1 parent 1a4e2d0 commit 5785a21

File tree

1 file changed

+40
-22
lines changed

1 file changed

+40
-22
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,12 +1497,6 @@ def slow_scroll_to(self, selector, by=By.CSS_SELECTOR,
14971497
selector, by=by, timeout=timeout)
14981498
self.__slow_scroll_to_element(element)
14991499

1500-
@decorators.deprecated("Use self.click() - It now scrolls before clicking")
1501-
def scroll_click(self, selector, by=By.CSS_SELECTOR):
1502-
# DEPRECATED - self.click() now scrolls to the element before clicking
1503-
# self.scroll_to(selector, by=by) # Redundant
1504-
self.click(selector, by=by)
1505-
15061500
def click_xpath(self, xpath):
15071501
# Technically self.click() will automatically detect an xpath selector,
15081502
# so self.click_xpath() is just a longer name for the same action.
@@ -1614,11 +1608,6 @@ def ad_block(self):
16141608
except Exception:
16151609
pass # Don't fail test if ad_blocking fails
16161610

1617-
@decorators.deprecated("Use re.escape() instead! It does what you want!")
1618-
def jq_format(self, code):
1619-
# DEPRECATED - re.escape() already does that thing you want!
1620-
return js_utils._jq_format(code)
1621-
16221611
def get_domain_url(self, url):
16231612
return page_utils.get_domain_url(url)
16241613

@@ -1893,8 +1882,8 @@ def js_update_text(self, selector, new_value, by=By.CSS_SELECTOR,
18931882
self.set_value(
18941883
selector, new_value, by=by, timeout=timeout)
18951884

1896-
def jquery_update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
1897-
timeout=settings.LARGE_TIMEOUT):
1885+
def jquery_update_text(self, selector, new_value, by=By.CSS_SELECTOR,
1886+
timeout=settings.LARGE_TIMEOUT):
18981887
""" This method uses jQuery to update a text field.
18991888
If the new_value string ends with the newline character,
19001889
WebDriver will finish the call, which simulates pressing
@@ -1919,15 +1908,6 @@ def jquery_update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
19191908
element.send_keys('\n')
19201909
self.__demo_mode_pause_if_active()
19211910

1922-
def jquery_update_text(self, selector, new_value, by=By.CSS_SELECTOR,
1923-
timeout=settings.LARGE_TIMEOUT):
1924-
""" The shorter version of self.jquery_update_text_value()
1925-
(The longer version remains for backwards compatibility.) """
1926-
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
1927-
timeout = self.__get_new_timeout(timeout)
1928-
self.jquery_update_text_value(
1929-
selector, new_value, by=by, timeout=timeout)
1930-
19311911
def hover_on_element(self, selector, by=By.CSS_SELECTOR):
19321912
if page_utils.is_xpath_selector(selector):
19331913
selector = self.convert_to_css_selector(selector, By.XPATH)
@@ -3086,6 +3066,44 @@ def __highlight_with_jquery_2(self, message, selector, o_bs):
30863066

30873067
############
30883068

3069+
# Deprecated Methods (Replace these if they're still in your code!)
3070+
3071+
@decorators.deprecated(
3072+
"scroll_click() is deprecated. Use self.click() - It scrolls for you!")
3073+
def scroll_click(self, selector, by=By.CSS_SELECTOR):
3074+
# DEPRECATED - self.click() now scrolls to the element before clicking.
3075+
# self.scroll_to(selector, by=by) # Redundant
3076+
self.click(selector, by=by)
3077+
3078+
@decorators.deprecated(
3079+
"update_text_value() is deprecated. Use self.update_text() instead!")
3080+
def update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
3081+
timeout=settings.LARGE_TIMEOUT, retry=False):
3082+
# DEPRECATED - self.update_text() should be used instead.
3083+
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
3084+
timeout = self.__get_new_timeout(timeout)
3085+
if page_utils.is_xpath_selector(selector):
3086+
by = By.XPATH
3087+
self.update_text(
3088+
selector, new_value, by=by, timeout=timeout, retry=retry)
3089+
3090+
@decorators.deprecated(
3091+
"jquery_update_text_value() is deprecated. Use jquery_update_text()")
3092+
def jquery_update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
3093+
timeout=settings.LARGE_TIMEOUT):
3094+
# DEPRECATED - self.jquery_update_text() should be used instead.
3095+
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
3096+
timeout = self.__get_new_timeout(timeout)
3097+
self.jquery_update_text(selector, new_value, by=by, timeout=timeout)
3098+
3099+
@decorators.deprecated(
3100+
"jq_format() is deprecated. Use re.escape() instead!")
3101+
def jq_format(self, code):
3102+
# DEPRECATED - re.escape() already performs the intended action!
3103+
return js_utils._jq_format(code)
3104+
3105+
############
3106+
30893107
def setUp(self, masterqa_mode=False):
30903108
"""
30913109
Be careful if a subclass of BaseCase overrides setUp()

0 commit comments

Comments
 (0)