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/logg.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, Logs, Mark, MethodLogger, Open, Shot, Text, Vrfy, Wait, WebdroneError, Xlsx

Constant Summary collapse

VERSION =
"1.7.4"
@@running_pry =
false

Class Method Summary collapse

Class Method Details

.create(*args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/webdrone.rb', line 33

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

.irb_console(binding = nil) ⇒ Object



48
49
50
51
52
53
# File 'lib/webdrone.rb', line 48

def self.irb_console(binding = nil)
  puts "Webdrone: Webdrone.irb_console IS DEPRECATED, please use a0.console instead."
  return if IRB.CurrentContext and not binding
  binding = Kernel.binding.of_caller(1) if binding == nil
  IRB.start_session(binding)
end

.pry_console(binding = nil) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/webdrone.rb', line 56

def self.pry_console(binding = nil)
  if @@running_pry
    puts "Webdrone: pry console already running."
  else
    @@running_pry = true
    binding = Kernel.binding.of_caller(1) unless binding
    binding.pry
    @@running_pry = false
  end
end

.report_error(a0, exception) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/webdrone/error.rb', line 133

def self.report_error(a0, exception)
  return if a0.conf.error == :ignore
  if exception.class != WebdroneError
    exception = WebdroneError.new(exception.message, exception, a0, Kernel.binding.callers)
    if a0.conf.developer and exception.binding
      exception.write_title "STARTING DEVELOPER CONSOLE ON ERROR"
      exception.dump_error_report
      a0.console exception.binding
    end
  end

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