class GenericTest::Page
Represents a web page state at a particular point of time
Attributes
emails[RW]
@return [Array] List of emails
html[RW]
links[RW]
@return [Array] List of links
text[RW]
title[RW]
url[RW]
Public Class Methods
new(browser)
click to toggle source
Store state of page when it is loaded @param [Watir::Browser] browser Watir browser
# File lib/generic_test/page.rb, line 17 def initialize(browser) self.emails, self.links = browser.links.partition do |link| link.href.start_with?('mailto:') end links.reject! { |link| link.href.empty? || link.href.start_with?('javascript:') } emails.collect! { |link| link.href.split(':').last } self.url = browser.url self.html = browser.html self.text = browser.text self.title = browser.title puts "Found #{links.count} links, #{emails.count} emails at #{url} (#{title})" end