Same as self.update_text() This method updates an element's text field with new text. Has multiple parts: * Waits for the element to be visible. * Waits for the element to be interactive. * Clears the text field. * Types in the new text. * Hits
(
self, selector, text, by="css selector", timeout=None, retry=False
)
| 1095 | self.__slow_mode_pause_if_active() |
| 1096 | |
| 1097 | def type( |
| 1098 | self, selector, text, by="css selector", timeout=None, retry=False |
| 1099 | ): |
| 1100 | """Same as self.update_text() |
| 1101 | This method updates an element's text field with new text. |
| 1102 | Has multiple parts: |
| 1103 | * Waits for the element to be visible. |
| 1104 | * Waits for the element to be interactive. |
| 1105 | * Clears the text field. |
| 1106 | * Types in the new text. |
| 1107 | * Hits Enter/Submit (if the text ends in "\n"). |
| 1108 | @Params |
| 1109 | selector - The selector of the text field. |
| 1110 | text - The new text to type into the text field. |
| 1111 | by - The type of selector to search by. (Default: "css selector") |
| 1112 | timeout - How long to wait for the selector to be visible. |
| 1113 | retry - If True, use JS if the Selenium text update fails. |
| 1114 | DO NOT confuse self.type() with Python type()! They are different! |
| 1115 | """ |
| 1116 | self.__check_scope() |
| 1117 | if not timeout: |
| 1118 | timeout = settings.LARGE_TIMEOUT |
| 1119 | if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT: |
| 1120 | timeout = self.__get_new_timeout(timeout) |
| 1121 | selector, by = self.__recalculate_selector(selector, by) |
| 1122 | self.update_text(selector, text, by=by, timeout=timeout, retry=retry) |
| 1123 | |
| 1124 | def send_keys(self, selector, text, by="css selector", timeout=None): |
| 1125 | """Same as self.add_text() |
no test coverage detected