Converting some CSS selectors to XPath
This commit is contained in:
parent
e88772021b
commit
a205b6fa44
|
@ -138,7 +138,7 @@ module Webrat
|
|||
end
|
||||
|
||||
unless id.blank?
|
||||
@label_elements += Webrat::XML.css_search(form.element, "label[@for='#{id}']")
|
||||
@label_elements += Webrat::XML.xpath_search(form.element, ".//label[@for = '#{id}']")
|
||||
end
|
||||
|
||||
@label_elements
|
||||
|
@ -373,8 +373,8 @@ module Webrat
|
|||
protected
|
||||
|
||||
def default_value
|
||||
selected_options = Webrat::XML.css_search(@element, "option[@selected='selected']")
|
||||
selected_options = Webrat::XML.css_search(@element, "option:first") if selected_options.empty?
|
||||
selected_options = Webrat::XML.xpath_search(@element, ".//option[@selected = 'selected']")
|
||||
selected_options = Webrat::XML.xpath_search(@element, ".//option[position() = 1]") if selected_options.empty?
|
||||
|
||||
selected_options.map do |option|
|
||||
return "" if option.nil?
|
||||
|
|
|
@ -9,10 +9,6 @@ module Webrat
|
|||
".//a[@href]"
|
||||
end
|
||||
|
||||
def self.css_search
|
||||
"a[@href]"
|
||||
end
|
||||
|
||||
def click(options = {})
|
||||
method = options[:method] || http_method
|
||||
return if href =~ /^#/ && method == :get
|
||||
|
|
|
@ -41,7 +41,7 @@ module Webrat
|
|||
end
|
||||
|
||||
def link_elements
|
||||
Webrat::XML.css_search(@dom, *Link.css_search)
|
||||
Webrat::XML.xpath_search(@dom, *Link.xpath_search)
|
||||
end
|
||||
|
||||
def replace_nbsp(str)
|
||||
|
|
Loading…
Reference in New Issue