Class: RCrawler::Driver
- Inherits:
-
Object
- Object
- RCrawler::Driver
- Includes:
- Capybara::DSL
- Defined in:
- lib/rcrawler/driver.rb
Instance Attribute Summary collapse
-
#headless ⇒ Object
Returns the value of attribute headless.
Instance Method Summary collapse
- #doc ⇒ Object
-
#initialize(options = {}) ⇒ Driver
constructor
A new instance of Driver.
- #screenshot(url, file_path) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Driver
Returns a new instance of Driver.
9 10 11 12 |
# File 'lib/rcrawler/driver.rb', line 9 def initialize(={}) @headless = .fetch(:headless, Headless.new) @headless.start if @headless end |
Instance Attribute Details
#headless ⇒ Object
Returns the value of attribute headless.
7 8 9 |
# File 'lib/rcrawler/driver.rb', line 7 def headless @headless end |
Instance Method Details
#doc ⇒ Object
19 20 21 |
# File 'lib/rcrawler/driver.rb', line 19 def doc Nokogiri::HTML(page.html) end |
#screenshot(url, file_path) ⇒ Object
14 15 16 17 |
# File 'lib/rcrawler/driver.rb', line 14 def screenshot(url, file_path) visit(url) page.save_screenshot(file_path) end |