Add check_vanished() in webkitelem.insert_text

This commit is contained in:
Florian Bruhin 2016-09-07 11:29:26 +02:00
parent 8f9cfcf232
commit e700d11447
2 changed files with 3 additions and 1 deletions

View File

@ -136,6 +136,7 @@ class WebKitElement(webelem.AbstractWebElement):
self._elem.evaluateJavaScript("this.value='{}'".format(text))
def insert_text(self, text):
self._check_vanished()
if not self.is_editable(strict=True):
raise webelem.Error("Element is not editable!")
log.misc.debug("Inserting text into element {!r}".format(self))

View File

@ -260,6 +260,7 @@ class TestWebKitElement:
lambda e: e.style_property('visibility', strategy='computed'),
lambda e: e.text(),
lambda e: e.set_text('foo'),
lambda e: e.insert_text('foo'),
lambda e: e.is_writable(),
lambda e: e.is_content_editable(),
lambda e: e.is_editable(),
@ -272,7 +273,7 @@ class TestWebKitElement:
lambda e: e.is_visible(None),
], ids=['str', 'getitem', 'setitem', 'delitem', 'contains', 'iter', 'len',
'frame', 'geometry', 'style_property', 'text', 'set_text',
'is_writable', 'is_content_editable', 'is_editable',
'insert_text', 'is_writable', 'is_content_editable', 'is_editable',
'is_text_input', 'remove_blank_target', 'debug_text', 'outer_xml',
'tag_name', 'rect_on_view', 'is_visible'])
def test_vanished(self, elem, code):