Created
August 31, 2021 00:02
-
-
Save skinnyjames/3734634e78309e1b218b90dbedb8fefa to your computer and use it in GitHub Desktop.
crystal spec
This file contains 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
require "../spec_helper" | |
describe SeleniumWebdriver do | |
with_browser("http://localhost:8083/selectors.html") do |browser| | |
describe "Basic selectors" do | |
it "selects by class" do | |
link = browser.a(class: "link-destination") | |
link.text.should eq "Link" | |
end | |
it "selects by id" do | |
div = browser.div(id: "div1") | |
div.text.should eq "Div text" | |
end | |
end | |
end | |
end |
This file contains 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
def with_browser(url) | |
browser = SeleniumWebdriver::Browser.start :chrome | |
browser.goto url | |
yield browser | |
# browser.quit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment