Sha256: 70dfc05cbc473bb434f2f36de0b805f2146170d21a0f31303690b84674f837ee
Contents?: true
Size: 758 Bytes
Versions: 3
Compression:
Stored size: 758 Bytes
Contents
require 'time' require 'watir-webdriver' require_relative 'request_scraper' class UserRequestScraper def initialize(b) @b = b end def scrape @b.goto 'hd/ticket/euTicketFind.ssp' @b.button(value: 'Find').click request_locations = get_request_locations request_ids = request_locations.map { |l| l.match(/ticket_id=(\d+)/)[1].to_i } request_scraper = RequestScraper.new @b request_scraper.scrape_range request_ids end private def get_request_locations links = [] 5.times do links = @b.links(href: /euTicketView\.ssp\?ticket_id=/).to_a break unless links.empty? sleep 2 end puts "No requests found.\n\n#{@b.html}" if links.empty? links.map { |link| link.href }.reverse end end
Version data entries
3 entries across 3 versions & 1 rubygems