Class: RulethuStockExchange::Scraper

Inherits:
Object
  • Object
show all
Defined in:
lib/rulethu_stock_exchange/scraper.rb

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Scraper

Returns a new instance of Scraper.



6
7
8
9
# File 'lib/rulethu_stock_exchange/scraper.rb', line 6

def initialize(url)
  @url = url
  @driver = setup_driver
end

Instance Method Details

#scrape(selector) ⇒ Object



11
12
13
14
15
# File 'lib/rulethu_stock_exchange/scraper.rb', line 11

def scrape(selector)
  @driver.navigate.to(@url)
  sleep 5
  @driver.find_element :css, selector
end