Module: LapisLazuli::WorldModule::Browser

Extended by:
ClassMethods
Includes:
Config, Error, Logging, Proxy
Included in:
LapisLazuli
Defined in:
lib/lapis_lazuli/world/browser.rb

Overview

Module managing a browser instance

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from ClassMethods

browser_module, browser_modules

Methods included from Proxy

#has_proxy?, #proxy

Methods included from Logging

#log

Methods included from Config

#config, #current_env, #env, #env_or_config, #has_config?, #has_env?, #has_env_or_config?, #init, #load_config, #load_config_from_file, #var_from_env

Methods included from Config::ClassMethods

#config_file, #config_file=

Methods included from Error

#error, #start_debugger

Instance Method Details

#browser(*args) ⇒ Object

Get the current main browser



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# 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
    LapisLazuli::Browser.new(*args)
  end

  if not b.is_open?
    b.start
  end

  return b
end

#has_browser?Boolean

Checks if there is a browser started

Returns:

  • (Boolean)


43
44
45
46
# 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