Class: SeleniumDSL::Capybara::DSL
- Inherits:
-
Object
- Object
- SeleniumDSL::Capybara::DSL
- Includes:
- SeleniumHelper
- Defined in:
- lib/selenium_dsl/capybara/dsl.rb
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
-
#timeout_in_seconds ⇒ Object
writeonly
Sets the attribute timeout_in_seconds.
Instance Method Summary collapse
- #capybara(&block) ⇒ Object
-
#initialize(selenium_host, selenium_port, browser, webapp_url, requested_driver, capabilities = {}) ⇒ DSL
constructor
A new instance of DSL.
- #start ⇒ Object
- #stop ⇒ Object
Methods included from SeleniumHelper
Constructor Details
#initialize(selenium_host, selenium_port, browser, webapp_url, requested_driver, capabilities = {}) ⇒ DSL
Returns a new instance of DSL.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/selenium_dsl/capybara/dsl.rb', line 16 def initialize(selenium_host, selenium_port, browser, webapp_url, requested_driver, capabilities={}) .run_server = false .app_host = webapp_url if requested_driver == :selenium requested_driver = "selenium_#{browser}".to_sym .register_driver requested_driver do |app| client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = 120 #caps = Selenium::WebDriver::Remote::Capabilities.firefox ::Selenium::Driver.new(app, {:url => construct_selenium_url(selenium_host, selenium_port), :browser => :remote, :desired_capabilities => browser.to_sym, :http_client => client}) end end .javascript_driver = requested_driver.to_sym .current_driver = requested_driver.to_sym @session = ::Session.new(requested_driver.to_sym, nil) @script = SeleniumDSL::::Script.new @session end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
12 13 14 |
# File 'lib/selenium_dsl/capybara/dsl.rb', line 12 def driver @driver end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
12 13 14 |
# File 'lib/selenium_dsl/capybara/dsl.rb', line 12 def script @script end |
#timeout_in_seconds=(timeout_in_seconds) ⇒ Object (writeonly)
Sets the attribute timeout_in_seconds
14 15 16 |
# File 'lib/selenium_dsl/capybara/dsl.rb', line 14 def timeout_in_seconds=(value) @timeout_in_seconds = value end |
Instance Method Details
#capybara(&block) ⇒ Object
60 61 62 63 64 |
# File 'lib/selenium_dsl/capybara/dsl.rb', line 60 def (&block) @script.instance_eval(&block) @script end |
#start ⇒ Object
46 47 |
# File 'lib/selenium_dsl/capybara/dsl.rb', line 46 def start end |
#stop ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/selenium_dsl/capybara/dsl.rb', line 49 def stop @session.reset! .use_default_driver .app_host = nil #Capybara::Driver::Webkit::Browser #@session.driver.browser.close end |