Created
May 26, 2011 17:28
-
-
Save richdownie/993572 to your computer and use it in GitHub Desktop.
(selenium-webdriver + cucumber + rspec) equivalence to watir contains_text?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FEATURE: | |
Scenario: Google Landing Page | |
* I am on the google page | |
* I should see "About Google" | |
* I should NOT see "Fidel Castro" | |
STEPS: | |
Given /I should (NOT )?see "(.*)"/ do |visibility, what| | |
result = @browser.find_elements(:xpath, "//*[text()='" + what + "']") | |
if (visibility.to_s.strip == 'NOT') then | |
result.count.should == 0 | |
p ("#{result.count}" + " text matches found") | |
else | |
result.count.should >= 1 | |
p ("#{result.count}" + " matching text strings found") | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment