Improve JS value type checks
This commit is contained in:
parent
571f0c4486
commit
6458c692cb
@ -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(
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user