class PageMagic::Drivers

class Drivers - creates an object that can be used to hold driver definitions These PageMagic gets the user’s chosen driver from this object.

Constants

Poltergeist
RackTest
Selenium

Public Instance Methods

==(other) click to toggle source

returns true if this driver instance is equal to the supplied object @param [Object] other subject of equality check @return [Boolean] true if the object is a match

# File lib/page_magic/drivers.rb, line 38
def ==(other)
  other.respond_to?(:all) && all == other.all
end
all() click to toggle source
# File lib/page_magic/drivers.rb, line 9
def all
  @all ||= []
end
find(browser) click to toggle source

Find a driver definition based on its registered name @param [Symbol] browser registered name of the required browser

# File lib/page_magic/drivers.rb, line 15
def find(browser)
  all.find { |driver| driver.support?(browser) }
end
load(path = " click to toggle source

Loads drivers defined in files at the given path @param [String] path where the drivers are located

# File lib/page_magic/drivers.rb, line 21
def load(path = "#{__dir__}/drivers")
  Dir["#{path}/*.rb"].sort.each do |driver_file|
    require driver_file
    driver_name = File.basename(driver_file)[/(.*)\.rb$/, 1]
    register self.class.const_get(Utils::String.classify(driver_name))
  end
end
register(driver) click to toggle source

Make a driver available for selection when creating calling {PageMagic.session} @param [Driver] driver driver definition

# File lib/page_magic/drivers.rb, line 31
def register(driver)
  all << driver
end