Class: Webrat::Selenium::Matchers::HaveXpath
- Inherits:
-
Object
- Object
- Webrat::Selenium::Matchers::HaveXpath
- Defined in:
- lib/webrat/selenium/matchers/have_xpath.rb
Instance Method Summary (collapse)
- - (Boolean) does_not_match?(response)
-
- (Object) failure_message
Returns
String
The failure message.
-
- (HaveXpath) initialize(expected)
constructor
A new instance of HaveXpath.
- - (Boolean) matches?(response)
-
- (Object) negative_failure_message
Returns
String
The failure message to be displayed in negative matches.
Constructor Details
- (HaveXpath) initialize(expected)
A new instance of HaveXpath
5 6 7 |
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 5 def initialize(expected) @expected = expected end |
Instance Method Details
- (Boolean) does_not_match?(response)
17 18 19 20 21 22 23 |
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 17 def does_not_match?(response) response.session.wait_for do !response.selenium.is_element_present("xpath=#{@expected}") end rescue Webrat::TimeoutError false end |
- (Object) failure_message
Returns
String |
The failure message. |
27 28 29 |
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 27 def "expected following text to match xpath #{@expected}:\n#{@document}" end |
- (Boolean) matches?(response)
9 10 11 12 13 14 15 |
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 9 def matches?(response) response.session.wait_for do response.selenium.is_element_present("xpath=#{@expected}") end rescue Webrat::TimeoutError false end |
- (Object) negative_failure_message
Returns
String |
The failure message to be displayed in negative matches. |
33 34 35 |
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 33 def "expected following text to not match xpath #{@expected}:\n#{@document}" end |