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.2.2"
- @@running_pry =
false
Class Method Summary
collapse
Class Method Details
.create(*args) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/webdrone.rb', line 29
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
44
45
46
47
48
49
|
# File 'lib/webdrone.rb', line 44
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
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/webdrone.rb', line 52
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
132
133
134
135
136
137
138
139
140
141
142
143
144
|
# File 'lib/webdrone/error.rb', line 132
def self.report_error(a0, exception)
return if a0.conf.error == :ignore
if exception.class != WebdroneError
exception = WebdroneError.new(exception.message, exception, a0, Kernel.caller_locations)
if a0.conf.developer and not exception.caller_location_index.nil?
exception.write_title "STARTING DEVELOPER CONSOLE ON ERROR"
exception.dump_error_report
a0.console Kernel.binding.of_caller(exception.caller_location_index + 1)
end
end
raise exception if a0.conf.error == :raise or a0.conf.error == :raise_report
end
|