2012-11-26 16:36:43 +00:00
|
|
|
require "persistent_selenium/version"
|
2013-04-09 15:37:14 +00:00
|
|
|
require 'selenium-webdriver'
|
2012-11-26 16:36:43 +00:00
|
|
|
|
|
|
|
module PersistentSelenium
|
|
|
|
class << self
|
2013-08-14 16:08:40 +00:00
|
|
|
attr_writer :port, :browser, :timeout, :chrome_extensions
|
2012-11-26 16:36:43 +00:00
|
|
|
|
|
|
|
def port
|
|
|
|
@port ||= 9854
|
|
|
|
end
|
|
|
|
|
|
|
|
def browser
|
|
|
|
@browser ||= :firefox
|
|
|
|
end
|
|
|
|
|
2013-05-14 14:57:55 +00:00
|
|
|
def timeout
|
|
|
|
@timeout ||= 120
|
|
|
|
end
|
|
|
|
|
2013-08-14 16:08:40 +00:00
|
|
|
def chrome_extensions
|
|
|
|
@chrome_extensions ||= []
|
|
|
|
end
|
|
|
|
|
2012-11-26 16:36:43 +00:00
|
|
|
def url
|
|
|
|
"druby://localhost:#{port}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def configure
|
|
|
|
yield self
|
|
|
|
end
|
2013-08-14 16:08:40 +00:00
|
|
|
|
|
|
|
def load_dotfile(file = '.persistent_selenium')
|
|
|
|
if File.file?(file)
|
|
|
|
load file
|
|
|
|
end
|
|
|
|
end
|
2012-11-26 16:36:43 +00:00
|
|
|
end
|
|
|
|
end
|