Module: Common
- Defined in:
- lib/spider_rails/common/common.rb
Defined Under Namespace
Classes: Common
Class Method Summary collapse
Class Method Details
.close_all_chromes ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/spider_rails/common/common.rb', line 27 def close_all_chromes chromes = `xdotool search 'google-chrome'` chromes = chromes.split(/\s+/) chromes.each do |chrome| `xdotool windowkill #{chrome}` end end |
.start(driver, url) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/spider_rails/common/common.rb', line 20 def start driver, url #@browser = Watir::Browser.new :chrome, switches: %w( --user-data-dir=/home/zxr/.config/google-chrome) @browser = Watir::Browser.new driver @browser.goto url @browser end |