Improve JS value type checks

This commit is contained in:
Florian Bruhin 2017-04-28 15:15:32 +02:00
parent 571f0c4486
commit 6458c692cb
3 changed files with 10 additions and 1 deletions

View File

@ -1505,6 +1505,7 @@ class CommandDispatcher:
if text is None:
message.error("Could not get text from the focused element.")
return
assert isinstance(text, str), text
ed = editor.ExternalEditor(self._tabbed_browser)
ed.editing_finished.connect(functools.partial(

View File

@ -112,7 +112,9 @@ class WebKitElement(webelem.AbstractWebElement):
def value(self):
self._check_vanished()
return self._elem.evaluateJavaScript('this.value')
val = self._elem.evaluateJavaScript('this.value')
assert isinstance(val, (int, float, str)), val
return val
def set_value(self, value):
self._check_vanished()

View File

@ -741,3 +741,9 @@ Feature: Various utility commands.
And I run :click-element id icon
And I wait for "Clicked non-editable element!" in the log
Then no crash should happen
Scenario: Clicking on li element
When I open data/issue2569.html
And I run :click-element id listitem
And I wait for "Clicked non-editable element!" in the log
Then no crash should happen