Skip to content

Instantly share code, notes, and snippets.

@skinnyjames
Created August 31, 2021 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skinnyjames/3734634e78309e1b218b90dbedb8fefa to your computer and use it in GitHub Desktop.
Save skinnyjames/3734634e78309e1b218b90dbedb8fefa to your computer and use it in GitHub Desktop.
crystal spec
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
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