module LapisLazuli::WorldModule::Browser
Module managing a browser instance
Public Instance Methods
browser(*args)
click to toggle source
Get the current main browser
# File lib/lapis_lazuli/world/browser.rb, line 50 def browser(*args) b = Runtime.instance.set_if(self, :browser) do # Add LL to the arguments for the browser LapisLazuli::Browser.set_world(self) # Create & return a new browser object brow = LapisLazuli::Browser.new(*args) metadata = Runtime.instance.get(:metadata) if metadata metadata.set( "browser", { "name" => brow.driver.capabilities[:browser_name], "version" => brow.driver.capabilities[:browser_version] || brow.driver.capabilities[:version], "platform" => brow.driver.capabilities[:platform_name] || brow.driver.capabilities[:platform], } ) end sessionid = brow.driver.capabilities["webdriver.remote.sessionid"] if !sessionid.nil? metadata.set("sessionid", sessionid) end brow end if not b.is_open? b.start end return b end
has_browser?()
click to toggle source
Checks if there is a browser started
# File lib/lapis_lazuli/world/browser.rb, line 43 def has_browser? b = Runtime.instance.get :browser return (not b.nil? and b.is_open?) end