Skip to content

Commit 3775b7a

Browse files
committed
More methods with better names
1 parent a3c91ba commit 3775b7a

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ def click_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT):
6767
if settings.WAIT_FOR_RSC_ON_CLICKS:
6868
self.wait_for_ready_state_complete()
6969

70+
def add_text(self, selector, new_value, timeout=settings.SMALL_TIMEOUT):
71+
""" The more-reliable version of driver.send_keys()
72+
Similar to update_text(), but won't clear the text field first. """
73+
element = self.wait_for_element_visible(selector, timeout=timeout)
74+
element.send_keys(new_value)
75+
7076
def update_text_value(self, selector, new_value,
7177
timeout=settings.SMALL_TIMEOUT, retry=False):
72-
""" This method updates a selector's text value with a new value
78+
""" This method updates an element's text value with a new value.
7379
@Params
7480
selector - the selector with the value to update
7581
new_value - the new value for setting the text field
@@ -85,6 +91,14 @@ def update_text_value(self, selector, new_value,
8591
selector = self.jq_format(selector)
8692
self.set_value(selector, new_value)
8793

94+
def update_text(self, selector, new_value,
95+
timeout=settings.SMALL_TIMEOUT, retry=False):
96+
""" The shorter version of update_text_value(), which
97+
clears existing text and adds new text into the text field.
98+
We want to keep the old version for backward compatibility. """
99+
self.update_text_value(selector, new_value,
100+
timeout=timeout, retry=retry)
101+
88102
def is_element_present(self, selector, by=By.CSS_SELECTOR):
89103
return page_actions.is_element_present(self.driver, selector, by)
90104

@@ -145,6 +159,10 @@ def jquery_update_text_value(self, selector, new_value,
145159
if new_value.endswith('\n'):
146160
element.send_keys('\n')
147161

162+
def jquery_update_text(self, selector, new_value,
163+
timeout=settings.SMALL_TIMEOUT):
164+
self.jquery_update_text_value(selector, new_value, timeout=timeout)
165+
148166
def hover_on_element(self, selector):
149167
return page_actions.hover_on_element(self.driver, selector)
150168

0 commit comments

Comments
 (0)