Module: CucumberSteps::WorldExtensions::BrowserMethods
- Defined in:
- lib/cucumber_steps/world_extensions/browser_methods.rb
Instance Method Summary collapse
- #browser ⇒ Object
- #browser_name ⇒ Object
- #browser_name=(new_browser_name) ⇒ Object
- #parse_html_attributes(raw_attributes) ⇒ Object
- #reopen_browser! ⇒ Object
Instance Method Details
#browser ⇒ Object
5 6 7 |
# File 'lib/cucumber_steps/world_extensions/browser_methods.rb', line 5 def browser @browser || reopen_browser! end |
#browser_name ⇒ Object
24 25 26 |
# File 'lib/cucumber_steps/world_extensions/browser_methods.rb', line 24 def browser_name CucumberSteps::ENVFetcher.browser_name || @browser_name || 'phantomjs' end |
#browser_name=(new_browser_name) ⇒ Object
20 21 22 |
# File 'lib/cucumber_steps/world_extensions/browser_methods.rb', line 20 def browser_name=(new_browser_name) @browser_name = new_browser_name.to_s.strip end |
#parse_html_attributes(raw_attributes) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/cucumber_steps/world_extensions/browser_methods.rb', line 28 def parse_html_attributes(raw_attributes) raw_attributes.scan(/(\w+)="([^"]+)"/).reduce({}) do |all_matcher, (attr_name, value)| all_matcher[attr_name.downcase.to_sym]=value all_matcher end end |
#reopen_browser! ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/cucumber_steps/world_extensions/browser_methods.rb', line 9 def reopen_browser! if @browser.is_a?(::CucumberSteps::Browser) @browser.close end browser = ::CucumberSteps::Browser.new(browser_name) @browser = browser end |