Rcrawler
The wrapper of capybara for crawler.
Installation
Add this line to your application's Gemfile:
gem 'rcrawler'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rcrawler
Usage
require "rcrawler"
RCrawler.crawl do
# Some capybara dsl
visit("https://example.com/login")
page.fill_in("name", with: "user")
page.fill_in("password", with: "secret")
page.("send")
page.save_screenshot("/tmp/example.png")
# Screenshot shortcut
# visit(arg[0]) and page.save_screenshot(arg[1])
screenshot("http://example.com", "/tmp/example.png")
# Nokogiri
# doc is return Nokogiri::HTML(page.html)
visit("http://example.com")
doc.css("a.some_link").each {|a| puts a.attr("href")}
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request