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

Method send_keys

seleniumbase/core/sb_cdp.py:1086–1102  ·  view source on GitHub ↗
(self, selector, text, timeout=None)

Source from the content-addressed store, hash-verified

1084 self.loop.run_until_complete(self.page.evaluate(js_code))
1085
1086 def send_keys(self, selector, text, timeout=None):
1087 if not timeout:
1088 timeout = settings.SMALL_TIMEOUT
1089 self.__slow_mode_pause_if_set()
1090 element = self.select(selector, timeout=timeout)
1091 element.scroll_into_view()
1092 if text.endswith("\n") or text.endswith("\r"):
1093 text = text[:-1] + "\r\n"
1094 elif (
1095 element.tag_name == "textarea"
1096 and "\n" in text
1097 and "\r" not in text
1098 ):
1099 text = text.replace("\n", "\r")
1100 element.send_keys(text)
1101 self.__slow_mode_pause_if_set()
1102 self.loop.run_until_complete(self.page.sleep(0.025))
1103
1104 def press_keys(self, selector, text, timeout=None):
1105 """Similar to send_keys(), but presses keys at human speed."""

Callers 15

set_valueMethod · 0.95
__press_keysMethod · 0.45
__typeMethod · 0.45
press_keysMethod · 0.45
typeMethod · 0.45
test_add_item_to_cartMethod · 0.45
test_add_item_to_cartMethod · 0.45
typeMethod · 0.45
test_add_item_to_cartMethod · 0.45
test_add_item_to_cartMethod · 0.45
test_add_item_to_cartMethod · 0.45

Calls 4

selectMethod · 0.95
scroll_into_viewMethod · 0.45
sleepMethod · 0.45