Use contains() instead of text()
This commit is contained in:
parent
0acee560a2
commit
90ea86ffd1
|
@ -31,7 +31,7 @@ class Webcat::Driver::RackTest
|
|||
|
||||
def select(option)
|
||||
node.xpath(".//option").each { |node| node.remove_attribute("selected") }
|
||||
node.xpath(".//option[text()='#{option}']").first["selected"] = 'selected'
|
||||
node.xpath(".//option[contains(.,'#{option}')]").first["selected"] = 'selected'
|
||||
end
|
||||
|
||||
def click
|
||||
|
|
|
@ -31,7 +31,7 @@ class Webcat::Driver::Selenium
|
|||
end
|
||||
|
||||
def select(option)
|
||||
node.find_element(:xpath, ".//option[text()='#{option}']").select
|
||||
node.find_element(:xpath, ".//option[contains(.,'#{option}')]").select
|
||||
end
|
||||
|
||||
def click
|
||||
|
|
|
@ -80,7 +80,7 @@ private
|
|||
end
|
||||
|
||||
def find_link(locator)
|
||||
link = find_element("//a[@id='#{locator}']", %{//a[text()="#{locator}"]}, %{//a[@title="#{locator}"]})
|
||||
link = find_element("//a[@id='#{locator}']", "//a[contains(.,'#{locator}')]", "//a[@title='#{locator}']")
|
||||
raise Webcat::ElementNotFound, "no button with value or id '#{locator}' found" unless link
|
||||
link
|
||||
end
|
||||
|
@ -124,7 +124,7 @@ private
|
|||
|
||||
def find_field_by_label(locator, *kinds)
|
||||
kinds.each do |kind|
|
||||
label = find("//label[text()='#{locator}']").first
|
||||
label = find("//label[contains(.,'#{locator}')]").first
|
||||
if label
|
||||
element = find_field_by_id(label[:for], kind)
|
||||
return element if element
|
||||
|
|
Loading…
Reference in New Issue