@@ -248,12 +248,26 @@ def type(self, selector, text, by=By.CSS_SELECTOR,
248
248
by = By .XPATH
249
249
self .update_text (selector , text , by = by , timeout = timeout , retry = retry )
250
250
251
+ def input (self , selector , text , by = By .CSS_SELECTOR ,
252
+ timeout = None , retry = False ):
253
+ """ Same as update_text(). """
254
+ if not timeout :
255
+ timeout = settings .LARGE_TIMEOUT
256
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
257
+ timeout = self .__get_new_timeout (timeout )
258
+ if page_utils .is_xpath_selector (selector ):
259
+ by = By .XPATH
260
+ self .update_text (selector , text , by = by , timeout = timeout , retry = retry )
261
+
251
262
def update_text (self , selector , new_value , by = By .CSS_SELECTOR ,
252
263
timeout = None , retry = False ):
253
264
""" This method updates an element's text field with new text.
254
- Has two parts:
255
- 1. Clears the text field.
256
- 2. Types in new text into the text field.
265
+ Has multiple parts:
266
+ * Waits for the element to be visible.
267
+ * Waits for the element to be interactive.
268
+ * Clears the text field.
269
+ * Types in the new text.
270
+ * Hits Enter/Submit (if the text ends in "\n ").
257
271
@Params
258
272
selector - the selector of the text field
259
273
new_value - the new value to type into the text field
0 commit comments