Module: SeleniumPlus
- Defined in:
- lib/selenium_plus.rb,
lib/selenium_plus/driver.rb,
lib/selenium_plus/finders.rb,
lib/selenium_plus/version.rb,
lib/selenium_plus/exceptions.rb,
lib/selenium_plus/page_obj/page.rb,
lib/selenium_plus/selenium/dlist.rb,
lib/selenium_plus/selenium/table.rb,
lib/selenium_plus/page_obj/iframe.rb,
lib/selenium_plus/selenium/select.rb,
lib/selenium_plus/page_obj/section.rb,
lib/selenium_plus/page_obj/container.rb
Defined Under Namespace
Modules: Container, Elements, Exceptions, Finders Classes: Driver, Iframe, Page, Section
Constant Summary collapse
- VERSION =
'0.1.0'
Class Attribute Summary collapse
-
.current_driver ⇒ Symbol
The name of the driver currently in use.
-
.default_driver ⇒ Symbol
The name of default driver.
-
.default_wait_time ⇒ Object
Returns the value of attribute default_wait_time.
-
.driver ⇒ Object
Returns the value of attribute driver.
-
.enable_highlight_element ⇒ Object
Returns the value of attribute enable_highlight_element.
Class Method Summary collapse
-
.configure {|_self| ... } ⇒ Object
Configure SeleniumPlus.
-
.drivers ⇒ Array
All register drivers.
-
.register_driver(name) { ... } ⇒ Object
Register a new driver for SeleniumPlus.
-
.use_default_driver ⇒ Object
Use the default driver as the current driver.
- .using_driver(driver) ⇒ Object
Class Attribute Details
.current_driver ⇒ Symbol
The name of the driver currently in use
82 83 84 |
# File 'lib/selenium_plus.rb', line 82 def current_driver @current_driver end |
.default_driver ⇒ Symbol
The name of default driver
75 76 77 |
# File 'lib/selenium_plus.rb', line 75 def default_driver @default_driver end |
.default_wait_time ⇒ Object
Returns the value of attribute default_wait_time.
33 34 35 |
# File 'lib/selenium_plus.rb', line 33 def default_wait_time @default_wait_time end |
.driver ⇒ Object
Returns the value of attribute driver.
33 34 35 |
# File 'lib/selenium_plus.rb', line 33 def driver @driver end |
.enable_highlight_element ⇒ Object
Returns the value of attribute enable_highlight_element.
33 34 35 |
# File 'lib/selenium_plus.rb', line 33 def enable_highlight_element @enable_highlight_element end |
Class Method Details
.configure {|_self| ... } ⇒ Object
Configure SeleniumPlus
Examples:
SeleniumPlus.configure do |config|
config.default_wait_time = 10
config.enable_highlight = true
end
- default_wait_time = Integer
- enable_highlight_element = Boolean
46 47 48 |
# File 'lib/selenium_plus.rb', line 46 def configure yield self end |
.drivers ⇒ Array
All register drivers
68 69 70 |
# File 'lib/selenium_plus.rb', line 68 def drivers @drivers ||= {} end |
.register_driver(name) { ... } ⇒ Object
Register a new driver for SeleniumPlus
Example:
SeleniumPlus.register_driver :chrome_driver do
SeleniumPlus::Driver.new(:browser => :chrome)
end
61 62 63 |
# File 'lib/selenium_plus.rb', line 61 def register_driver(name, &block) drivers[name] = block end |
.use_default_driver ⇒ Object
Use the default driver as the current driver
88 89 90 |
# File 'lib/selenium_plus.rb', line 88 def use_default_driver @current_driver = nil end |
.using_driver(driver) ⇒ Object
92 93 94 95 96 97 98 99 100 |
# File 'lib/selenium_plus.rb', line 92 def using_driver(driver) unless drivers.has_key?(driver) other_drivers = drivers.keys.map { |key| key.inspect } raise SeleniumPlus::Exceptions::DriverNotFoundError, "Driver #{driver} was not found. Available types: #{other_drivers.join(', ')}" end if @driver.nil? || @driver.native.browser != driver @driver = drivers[driver].call end end |