Module: Webdrone

Defined in:
lib/webdrone.rb,
lib/webdrone/clic.rb,
lib/webdrone/conf.rb,
lib/webdrone/ctxt.rb,
lib/webdrone/exec.rb,
lib/webdrone/find.rb,
lib/webdrone/form.rb,
lib/webdrone/html.rb,
lib/webdrone/mark.rb,
lib/webdrone/open.rb,
lib/webdrone/shot.rb,
lib/webdrone/text.rb,
lib/webdrone/vrfy.rb,
lib/webdrone/wait.rb,
lib/webdrone/xlsx.rb,
lib/webdrone/error.rb,
lib/webdrone/browser.rb,
lib/webdrone/version.rb

Defined Under Namespace

Classes: Browser, Clic, Conf, Ctxt, Exec, Find, Form, Html, Mark, Open, Shot, Text, Vrfy, Wait, WebdroneError, Xlsx

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.create(*args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/webdrone.rb', line 28

def self.create(*args)
  a0 = Webdrone::Browser.new *args
  if block_given?
    begin
      yield a0
    rescue => exception
      Webdrone.report_error(a0, exception, Kernel.caller_locations)
    ensure
      a0.quit
    end
  else
    a0
  end
end

.irb_console(binding = nil) ⇒ Object



43
44
45
46
47
# File 'lib/webdrone.rb', line 43

def self.irb_console(binding = nil)
  return if IRB.CurrentContext and not binding
  binding = Kernel.binding.of_caller(1) if binding == nil
  IRB.start_session(binding)
end

.report_error(a0, exception, caller_locations) ⇒ Object



146
147
148
149
150
151
152
# File 'lib/webdrone/error.rb', line 146

def self.report_error(a0, exception, caller_locations)
  return if a0.conf.error == :ignore
  exception = WebdroneError.new(exception.message, exception, a0, caller_locations) if exception.class != WebdroneError

  exception.start_console if a0.conf.developer
  raise exception if a0.conf.error == :raise or a0.conf.error == :raise_report
end