Add a focus_elem function to utils.webelem.
This commit is contained in:
parent
bbd9d24334
commit
810e507da9
@ -711,8 +711,7 @@ class CommandDispatcher:
|
||||
and do everything async.
|
||||
"""
|
||||
frame = self._tabs.currentWidget().page().currentFrame()
|
||||
elem = frame.findFirstElement(webelem.SELECTORS[
|
||||
webelem.Group.focus])
|
||||
elem = webelem.focus_elem(frame)
|
||||
if elem.isNull():
|
||||
raise CommandError("No element focused!")
|
||||
if not webelem.is_editable(elem):
|
||||
|
@ -247,3 +247,14 @@ def is_editable(elem):
|
||||
log.webview.debug("span with classes {} clicked!".format(
|
||||
elem.classes()))
|
||||
return False
|
||||
|
||||
|
||||
def focus_elem(frame):
|
||||
"""Get the focused element in a webframe.
|
||||
|
||||
FIXME: Add tests.
|
||||
|
||||
Args:
|
||||
frame: The QWebFrame to search in.
|
||||
"""
|
||||
return frame.findFirstElement(SELECTORS[Group.focus])
|
||||
|
Loading…
Reference in New Issue
Block a user