jsbrowser: When trying to find the submit control, also look for button tags with type="submit"

This commit is contained in:
Kovid Goyal 2015-07-15 08:17:48 +05:30
parent b11d1fe19f
commit b4f18732b8

View File

@ -8,6 +8,8 @@ __license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from itertools import chain
from calibre import as_unicode
default_timeout = object()
@ -116,6 +118,7 @@ class Form(object):
self.radio_controls = {name:RadioControl(name, [z.qwe for z in rc if z.name == name]) for name in rc_names}
selects = list(map(SelectControl, qwe.findAll('select')))
self.select_controls = {x.name:x for x in selects}
self.button_controls = list(map(Control, qwe.findAll('button')))
@property
def controls(self):
@ -173,7 +176,7 @@ class Form(object):
sc = self.qwe.findFirst(submit_control_selector)
if not sc.isNull():
return sc
for c in self.input_controls:
for c in chain(self.input_controls, self.button_controls):
if c.type == 'submit':
return c
for c in self.input_controls: