Exemplo n.º 1
0
 def insert_text(self, text: str) -> None:
     self._check_vanished()
     if not self.is_editable(strict=True):
         raise webelem.Error("Element is not editable!")
     log.webelem.debug("Inserting text into element {!r}".format(self))
     self._elem.evaluateJavaScript("""
         var text = {};
         var event = document.createEvent("TextEvent");
         event.initTextEvent("textInput", true, true, null, text);
         this.dispatchEvent(event);
     """.format(javascript.to_js(text)))
Exemplo n.º 2
0
 def insert_text(self, text):
     if not self.is_editable(strict=True):
         raise webelem.Error("Element is not editable!")
     log.webelem.debug("Inserting text into element {!r}".format(self))
     self._js_call('insert_text', text)
Exemplo n.º 3
0
 def insert_text(self, text):
     if not self.is_editable(strict=True):
         raise webelem.Error("Element is not editable!")
     log.webelem.debug("Inserting text into element {!r}".format(self))
     js_code = javascript.assemble('webelem', 'insert_text', self._id, text)
     self._tab.run_js_async(js_code)