require 'watir-webdriver' require 'selenium-webdriver' module PowerSchool module Configuration VALID_OPTION_KEYS = %w(host username password browser).freeze HOST = nil USERNAME = nil PASSWORD = nil attr_accessor *VALID_OPTION_KEYS def self.extend(base) base.reset end def reset self.host = HOST self.username = USERNAME self.password = PASSWORD end def configure yield self download_directory = "#{Dir.pwd}/downloads" profile = Selenium::WebDriver::Firefox::Profile.new profile["browser.download.useDownloadDir"] = true profile['browser.download.dir'] = download_directory profile['browser.helperApps.neverAsk.saveToDisk'] = "Document, text/plain" profile['browser.helperApps.neverAsk.openFile'] = "Document, text/plain" # puts profile.inspect #driver = Selenium::WebDriver.for :firefox, :profile => profile #self.browser ||= Watir::Browser.new(driver) self.browser ||= Watir::Browser.new :firefox, :profile => profile end end end