Look for actual <button>s as well

This commit is contained in:
Åsmund Grammeltvedt
2014-11-12 14:40:09 +01:00
parent 4a6671964c
commit 26320ea0d6
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -215,7 +215,7 @@ SeleniumWrapper
>>> br.img(alt="I am sorry", ext="sorry.gif")
* button(value, eager=False, timeout=3)
find_element_by_xpath("//input[@type='submit' or @type='button' and @value='{}']".format(value), timeout)::
find_element_by_xpath("//input[@type='submit' or @type='button' and @value='{0}']|.//button[text()='{0}']".format(value), timeout)::
>>> br.button("Send this form").click()
+3 -1
View File
@@ -440,7 +440,9 @@ class SeleniumWrapper(object):
return self.xpath(xpath, eager, timeout)
def button(self, value, eager=False, timeout=None):
return self.xpath(".//input[@type='submit' or @type='button' and @value='{0}']".format(value), eager, timeout)
return self.xpath(
".//input[@type='submit' or @type='button' and @value='{0}']"
"|.//button[text()='{0}']".format(value), eager, timeout)
def checkbox(self, eager=False, timeout=None, **attributes):
attributes["type"] = "checkbox"