MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / set_text

Method set_text

seleniumbase/fixtures/base_case.py:9201–9224  ·  view source on GitHub ↗

Same as self.js_update_text() JavaScript + send_keys are used to update a text field. Performs self.set_value() and triggers event listeners. If text ends in "\n", set_value() presses RETURN after. Works faster than send_keys() alone due to the JS call. If not

(self, selector, text, by="css selector", timeout=None)

Source from the content-addressed store, hash-verified

9199 self.js_update_text(selector, text, by=by, timeout=timeout)
9200
9201 def set_text(self, selector, text, by="css selector", timeout=None):
9202 """Same as self.js_update_text()
9203 JavaScript + send_keys are used to update a text field.
9204 Performs self.set_value() and triggers event listeners.
9205 If text ends in "\n", set_value() presses RETURN after.
9206 Works faster than send_keys() alone due to the JS call.
9207 If not an input or textarea, sets textContent instead."""
9208 self.__check_scope()
9209 if not timeout:
9210 timeout = settings.LARGE_TIMEOUT
9211 if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
9212 timeout = self.__get_new_timeout(timeout)
9213 selector, by = self.__recalculate_selector(selector, by)
9214 if self.__is_cdp_swap_needed():
9215 self.cdp.set_value(selector, text)
9216 return
9217 self.wait_for_ready_state_complete()
9218 element = page_actions.wait_for_element_present(
9219 self.driver, selector, by, timeout
9220 )
9221 if element.tag_name.lower() in ["input", "textarea"]:
9222 self.js_update_text(selector, text, by=by, timeout=timeout)
9223 else:
9224 self.set_text_content(selector, text, by=by, timeout=timeout)
9225
9226 def set_text_content(
9227 self, selector, text, by="css selector", timeout=None, scroll=False

Callers 9

tekst_instellenMethod · 0.80
définir_texteMethod · 0.80
impostare_testoMethod · 0.80
establecer_textoMethod · 0.80
텍스트_설정Method · 0.80
набор_текстMethod · 0.80
设置文本Method · 0.80
definir_textoMethod · 0.80

Calls 9

__check_scopeMethod · 0.95
__get_new_timeoutMethod · 0.95
__is_cdp_swap_neededMethod · 0.95
js_update_textMethod · 0.95
set_text_contentMethod · 0.95
set_valueMethod · 0.45

Tested by

no test coverage detected