webdrone 0.7.6 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -8
- data/lib/webdrone.rb +2 -0
- data/lib/webdrone/clic.rb +14 -0
- data/lib/webdrone/conf.rb +4 -0
- data/lib/webdrone/ctxt.rb +12 -0
- data/lib/webdrone/error.rb +110 -0
- data/lib/webdrone/exec.rb +2 -0
- data/lib/webdrone/find.rb +14 -0
- data/lib/webdrone/form.rb +14 -0
- data/lib/webdrone/mark.rb +14 -0
- data/lib/webdrone/open.rb +2 -0
- data/lib/webdrone/shot.rb +2 -0
- data/lib/webdrone/text.rb +16 -0
- data/lib/webdrone/version.rb +1 -1
- data/lib/webdrone/vrfy.rb +14 -0
- data/lib/webdrone/wait.rb +4 -0
- data/lib/webdrone/xlsx.rb +10 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95fbea40c3e54989776ca05aa1c2b6d263432fd3
|
4
|
+
data.tar.gz: 77b81600dd93c3d2802529511ecfce22915325da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e87fd8253681279f843a56e3ef2a170949dca72f29c84ed75e0c98715bf395f7c74ecfae5dd1dc8c3bfe55700ae8845bb4c4129b0928b0033e9889ea9cdee882
|
7
|
+
data.tar.gz: 0fd5df47de47f19941cff84b2b250a3be22a9c2f9bfd5b37b612a3ffedf4c360d8afac928631a54d46c3ea4b7844de450c289f294abe25468de729eb72104308
|
data/README.md
CHANGED
@@ -27,12 +27,12 @@ Create a browser:
|
|
27
27
|
```ruby
|
28
28
|
require 'webdrone'
|
29
29
|
|
30
|
-
a0 = Webdrone.create
|
30
|
+
a0 = Webdrone.create timeout: 5
|
31
31
|
a0.open.url 'http://www.google.com/'
|
32
32
|
a0.quit
|
33
33
|
|
34
34
|
# or
|
35
|
-
Webdrone.create do |a0|
|
35
|
+
Webdrone.create timeout: 5 do |a0|
|
36
36
|
a0.open.url 'http://www.google.com/'
|
37
37
|
end
|
38
38
|
```
|
@@ -40,17 +40,21 @@ end
|
|
40
40
|
Take a screenshot:
|
41
41
|
|
42
42
|
```ruby
|
43
|
-
a0.shot.
|
44
|
-
a0.shot.
|
43
|
+
a0.shot.screen 'login' # saves to screenshot-0001-login.png
|
44
|
+
a0.shot.screen 'home' # saves to screenshot-0002-home.png
|
45
45
|
```
|
46
46
|
|
47
47
|
Working with forms:
|
48
48
|
|
49
49
|
```ruby
|
50
|
-
|
51
|
-
a0
|
50
|
+
|
51
|
+
Webdrone.create do |a0|
|
52
|
+
a0.open.url 'http://www.google.com/'
|
53
|
+
a0.form.set 'q', 'A0::WebDrone'
|
54
|
+
a0.form.submit
|
52
55
|
end
|
53
56
|
|
57
|
+
|
54
58
|
# or
|
55
59
|
a0.form.with_xpath '//label[contains(.,"%s")]/following-sibling::*/*[self::input | self::textarea | self::select]' do
|
56
60
|
set 'label', 'value'
|
@@ -61,7 +65,7 @@ a0.form.submit
|
|
61
65
|
|
62
66
|
Filling a form from an xlsx spreadsheet:
|
63
67
|
```ruby
|
64
|
-
|
68
|
+
TODO
|
65
69
|
```
|
66
70
|
|
67
71
|
|
@@ -69,7 +73,7 @@ a0.conf.timeout 10
|
|
69
73
|
Config:
|
70
74
|
|
71
75
|
```ruby
|
72
|
-
|
76
|
+
TODO
|
73
77
|
```
|
74
78
|
|
75
79
|
Saving screenshots and downloaded files to a directory:
|
data/lib/webdrone.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'webdrone/version'
|
2
|
+
require 'webdrone/error'
|
2
3
|
require 'webdrone/browser'
|
3
4
|
require 'webdrone/open'
|
4
5
|
require 'webdrone/shot'
|
@@ -21,6 +22,7 @@ require 'fileutils'
|
|
21
22
|
require 'binding_of_caller'
|
22
23
|
require 'pathname'
|
23
24
|
|
25
|
+
|
24
26
|
module Webdrone
|
25
27
|
def self.create(*args)
|
26
28
|
a0 = Webdrone::Browser.new *args
|
data/lib/webdrone/clic.rb
CHANGED
@@ -14,30 +14,44 @@ module Webdrone
|
|
14
14
|
|
15
15
|
def id(text)
|
16
16
|
@a0.find.id(text).click
|
17
|
+
rescue => exception
|
18
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
17
19
|
end
|
18
20
|
|
19
21
|
def css(text, n: 1, all: false, visible: true)
|
20
22
|
@a0.find.css(text, n: n, all: all, visible: visible).click
|
23
|
+
rescue => exception
|
24
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
21
25
|
end
|
22
26
|
|
23
27
|
def link(text, n: 1, all: false, visible: true)
|
24
28
|
@a0.find.link(text, n: n, all: all, visible: visible).click
|
29
|
+
rescue => exception
|
30
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
25
31
|
end
|
26
32
|
|
27
33
|
def button(text, n: 1, all: false, visible: true)
|
28
34
|
@a0.find.button(text, n: n, all: all, visible: visible).click
|
35
|
+
rescue => exception
|
36
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
29
37
|
end
|
30
38
|
|
31
39
|
def on(text, n: 1, all: false, visible: true)
|
32
40
|
@a0.find.on(text, n: n, all: all, visible: visible).click
|
41
|
+
rescue => exception
|
42
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
33
43
|
end
|
34
44
|
|
35
45
|
def option(text, n: 1, all: false, visible: true)
|
36
46
|
@a0.find.option(text, n: n, all: all, visible: visible).click
|
47
|
+
rescue => exception
|
48
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
37
49
|
end
|
38
50
|
|
39
51
|
def xpath(text, n: 1, all: false, visible: true)
|
40
52
|
@a0.find.xpath(text, n: n, all: all, visible: visible).click
|
53
|
+
rescue => exception
|
54
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
41
55
|
end
|
42
56
|
end
|
43
57
|
end
|
data/lib/webdrone/conf.rb
CHANGED
@@ -16,11 +16,15 @@ module Webdrone
|
|
16
16
|
def timeout=(val)
|
17
17
|
@timeout = val
|
18
18
|
@a0.driver.manage.timeouts.implicit_wait = val
|
19
|
+
rescue => exception
|
20
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
19
21
|
end
|
20
22
|
|
21
23
|
def outdir=(val)
|
22
24
|
@outdir = val
|
23
25
|
FileUtils.mkdir_p val
|
26
|
+
rescue => exception
|
27
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
data/lib/webdrone/ctxt.rb
CHANGED
@@ -16,11 +16,15 @@ module Webdrone
|
|
16
16
|
def create_tab
|
17
17
|
@a0.exec.script "function a0_ctx_create_tab() { var w = window.open(); w.document.open(); w.document.write('A0 CTXT CREATE TAB'); w.document.close(); } a0_ctx_create_tab();"
|
18
18
|
@a0.driver.switch_to.window @a0.driver.window_handles.last
|
19
|
+
rescue => exception
|
20
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
19
21
|
end
|
20
22
|
|
21
23
|
def close_tab
|
22
24
|
@a0.driver.close
|
23
25
|
@a0.driver.switch_to.window @a0.driver.window_handles.last
|
26
|
+
rescue => exception
|
27
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
24
28
|
end
|
25
29
|
|
26
30
|
def with_frame(name)
|
@@ -36,21 +40,29 @@ module Webdrone
|
|
36
40
|
end
|
37
41
|
end
|
38
42
|
name
|
43
|
+
rescue => exception
|
44
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
39
45
|
end
|
40
46
|
|
41
47
|
def reset
|
42
48
|
@a0.driver.switch_to.default_content
|
43
49
|
@ramestack = []
|
50
|
+
rescue => exception
|
51
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
44
52
|
end
|
45
53
|
|
46
54
|
def with_alert
|
47
55
|
@a0.wait.for do
|
48
56
|
yield @a0.driver.switch_to.alert
|
49
57
|
end
|
58
|
+
rescue => exception
|
59
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
50
60
|
end
|
51
61
|
|
52
62
|
def ignore_alert
|
53
63
|
@a0.exec.script 'alert = function(message){return true;};'
|
64
|
+
rescue => exception
|
65
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
54
66
|
end
|
55
67
|
end
|
56
68
|
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
module Webdrone
|
2
|
+
class WebdroneError < StandardError
|
3
|
+
attr_reader :original, :a0, :caller_locations
|
4
|
+
def initialize(msg, original = $!, a0, caller_locations)
|
5
|
+
super(msg)
|
6
|
+
@original = original;
|
7
|
+
@a0 = a0
|
8
|
+
@caller_locations = caller_locations
|
9
|
+
@buffer = []
|
10
|
+
|
11
|
+
# find location of user error
|
12
|
+
@caller_locations[1..-1].each do |location|
|
13
|
+
if not location.path.include? 'lib/webdrone/'
|
14
|
+
@location = location
|
15
|
+
break
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
report_script
|
20
|
+
report_screenshot
|
21
|
+
report_exception
|
22
|
+
report_time
|
23
|
+
end
|
24
|
+
|
25
|
+
def write_line(line)
|
26
|
+
line = "#{line.chomp}\r\n"
|
27
|
+
@buffer << line
|
28
|
+
puts line
|
29
|
+
end
|
30
|
+
|
31
|
+
def write_title(title)
|
32
|
+
title = "#{title} " if title.length % 2 != 0
|
33
|
+
title = "== #{title} =="
|
34
|
+
filler = "="
|
35
|
+
length = (80 - title.length) / 2
|
36
|
+
title = "#{filler*length}#{title}#{filler*length}\n" if length > 1
|
37
|
+
write_line title
|
38
|
+
end
|
39
|
+
|
40
|
+
def dump_error_report
|
41
|
+
File.open(File.join(@a0.conf.outdir, "a0_webdrone_error_report.txt"), "a") do |file|
|
42
|
+
file.write(@buffer.join)
|
43
|
+
end
|
44
|
+
@buffer = []
|
45
|
+
end
|
46
|
+
|
47
|
+
def report_script
|
48
|
+
begin
|
49
|
+
ini, fin = [@location.lineno - 10 - 1, @location.lineno + 10 - 1]
|
50
|
+
ini = 0 if ini < 0
|
51
|
+
|
52
|
+
write_title "#{@location.path} AT LINE #{sprintf '%3d', @location.lineno}"
|
53
|
+
File.readlines(@location.path)[ini..fin].each_with_index do |line, index|
|
54
|
+
lno = index + ini + 1
|
55
|
+
if lno == @location.lineno
|
56
|
+
write_line sprintf "%3d ==> %s", lno, line
|
57
|
+
else
|
58
|
+
write_line sprintf "%3d %s", lno, line
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
dump_error_report
|
63
|
+
rescue
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def report_screenshot
|
68
|
+
begin
|
69
|
+
write_title "AUTOMATIC SCREENSHOT"
|
70
|
+
file = @a0.shot.screen 'a0_webdrone_error_report'
|
71
|
+
write_line "Saved: #{file.path}"
|
72
|
+
|
73
|
+
dump_error_report
|
74
|
+
rescue
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def report_exception
|
79
|
+
begin
|
80
|
+
write_title "EXCEPTION DUMP"
|
81
|
+
|
82
|
+
write_line "#{@original.class}: #{@original.message}"
|
83
|
+
@original.backtrace_locations.each do |location|
|
84
|
+
if location.path == @location.path and location.lineno == @location.lineno
|
85
|
+
write_line sprintf " ==> from %s", location
|
86
|
+
else
|
87
|
+
write_line sprintf " from %s", location
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
dump_error_report
|
92
|
+
rescue
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def report_time
|
97
|
+
write_title "#{Time.new}"
|
98
|
+
|
99
|
+
dump_error_report
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.report_error(a0, exception, caller_locations)
|
104
|
+
if exception.class == WebdroneError
|
105
|
+
raise exception
|
106
|
+
end
|
107
|
+
|
108
|
+
raise WebdroneError.new(exception.message, exception, a0, caller_locations)
|
109
|
+
end
|
110
|
+
end
|
data/lib/webdrone/exec.rb
CHANGED
data/lib/webdrone/find.rb
CHANGED
@@ -16,6 +16,8 @@ module Webdrone
|
|
16
16
|
@a0.wait.for do
|
17
17
|
@a0.driver.find_element :id, text
|
18
18
|
end
|
19
|
+
rescue => exception
|
20
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
19
21
|
end
|
20
22
|
|
21
23
|
def css(text, n: 1, all: false, visible: true)
|
@@ -23,22 +25,32 @@ module Webdrone
|
|
23
25
|
items = @a0.driver.find_elements :css, text
|
24
26
|
choose(items, n, all, visible)
|
25
27
|
end
|
28
|
+
rescue => exception
|
29
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
26
30
|
end
|
27
31
|
|
28
32
|
def link(text, n: 1, all: false, visible: true)
|
29
33
|
self.xpath XPath::HTML.link(text).to_s, n: n, all: all, visible: visible
|
34
|
+
rescue => exception
|
35
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
30
36
|
end
|
31
37
|
|
32
38
|
def button(text, n: 1, all: false, visible: true)
|
33
39
|
self.xpath XPath::HTML.button(text).to_s, n: n, all: all, visible: visible
|
40
|
+
rescue => exception
|
41
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
34
42
|
end
|
35
43
|
|
36
44
|
def on(text, n: 1, all: false, visible: true)
|
37
45
|
self.xpath XPath::HTML.link_or_button(text).to_s, n: n, all: all, visible: visible
|
46
|
+
rescue => exception
|
47
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
38
48
|
end
|
39
49
|
|
40
50
|
def option(text, n: 1, all: false, visible: true)
|
41
51
|
self.xpath XPath::HTML.option(text).to_s, n: n, all: all, visible: visible
|
52
|
+
rescue => exception
|
53
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
42
54
|
end
|
43
55
|
|
44
56
|
def xpath(text, n: 1, all: false, visible: true)
|
@@ -46,6 +58,8 @@ module Webdrone
|
|
46
58
|
items = @a0.driver.find_elements :xpath, text
|
47
59
|
choose(items, n, all, visible)
|
48
60
|
end
|
61
|
+
rescue => exception
|
62
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
49
63
|
end
|
50
64
|
|
51
65
|
protected
|
data/lib/webdrone/form.rb
CHANGED
@@ -15,6 +15,8 @@ module Webdrone
|
|
15
15
|
def with_xpath(xpath, &block)
|
16
16
|
@xpath = xpath
|
17
17
|
instance_eval &block
|
18
|
+
rescue => exception
|
19
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
18
20
|
end
|
19
21
|
|
20
22
|
def set(key, val)
|
@@ -26,29 +28,41 @@ module Webdrone
|
|
26
28
|
item.clear
|
27
29
|
item.send_keys(val)
|
28
30
|
end
|
31
|
+
rescue => exception
|
32
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
29
33
|
end
|
30
34
|
|
31
35
|
def get(key)
|
32
36
|
self.find_item(key)[:value]
|
37
|
+
rescue => exception
|
38
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
33
39
|
end
|
34
40
|
|
35
41
|
def clic(key)
|
36
42
|
self.find_item(key).click
|
43
|
+
rescue => exception
|
44
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
37
45
|
end
|
38
46
|
|
39
47
|
def mark(key, color: 'red')
|
40
48
|
@a0.mark.flash self.find_item(key), color: color
|
49
|
+
rescue => exception
|
50
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
41
51
|
end
|
42
52
|
|
43
53
|
def submit(key = nil)
|
44
54
|
self.find_item(key) if key
|
45
55
|
@lastitem.submit
|
56
|
+
rescue => exception
|
57
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
46
58
|
end
|
47
59
|
|
48
60
|
def xlsx(sheet: nil, filename: nil)
|
49
61
|
@a0.xlsx.dict(sheet: sheet, filename: filename).each do |k, v|
|
50
62
|
self.set k, v
|
51
63
|
end
|
64
|
+
rescue => exception
|
65
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
52
66
|
end
|
53
67
|
|
54
68
|
protected
|
data/lib/webdrone/mark.rb
CHANGED
@@ -14,30 +14,44 @@ module Webdrone
|
|
14
14
|
|
15
15
|
def id(text, color: 'red')
|
16
16
|
flash @a0.find.id(text), color: color
|
17
|
+
rescue => exception
|
18
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
17
19
|
end
|
18
20
|
|
19
21
|
def css(text, color: 'red', n: 1, all: false, visible: true)
|
20
22
|
flash @a0.find.css(text, n: n, all: all, visible: visible), color: color
|
23
|
+
rescue => exception
|
24
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
21
25
|
end
|
22
26
|
|
23
27
|
def link(text, color: 'red', n: 1, all: false, visible: true)
|
24
28
|
flash @a0.find.link(text, n: n, all: all, visible: visible), color: color
|
29
|
+
rescue => exception
|
30
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
25
31
|
end
|
26
32
|
|
27
33
|
def button(text, color: 'red', n: 1, all: false, visible: true)
|
28
34
|
flash @a0.find.button(text, n: n, all: all, visible: visible), color: color
|
35
|
+
rescue => exception
|
36
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
29
37
|
end
|
30
38
|
|
31
39
|
def on(text, color: 'red', n: 1, all: false, visible: true)
|
32
40
|
flash @a0.find.on(text, n: n, all: all, visible: visible), color: color
|
41
|
+
rescue => exception
|
42
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
33
43
|
end
|
34
44
|
|
35
45
|
def option(text, color: 'red', n: 1, all: false, visible: true)
|
36
46
|
flash @a0.find.option(text, n: n, all: all, visible: visible), color: color
|
47
|
+
rescue => exception
|
48
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
37
49
|
end
|
38
50
|
|
39
51
|
def xpath(text, color: 'red', n: 1, all: false, visible: true)
|
40
52
|
flash @a0.find.xpath(text, n: n, all: all, visible: visible), color: color
|
53
|
+
rescue => exception
|
54
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
41
55
|
end
|
42
56
|
|
43
57
|
def flash(item, color: 'red')
|
data/lib/webdrone/open.rb
CHANGED
data/lib/webdrone/shot.rb
CHANGED
@@ -17,6 +17,8 @@ module Webdrone
|
|
17
17
|
filename = sprintf "screenshot-%04d-%s.png", @counter, name
|
18
18
|
filename = File.join(@a0.conf.outdir, filename)
|
19
19
|
@a0.driver.save_screenshot filename
|
20
|
+
rescue => exception
|
21
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
data/lib/webdrone/text.rb
CHANGED
@@ -14,34 +14,50 @@ module Webdrone
|
|
14
14
|
|
15
15
|
def id(text)
|
16
16
|
@a0.find.id(text).text
|
17
|
+
rescue => exception
|
18
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
17
19
|
end
|
18
20
|
|
19
21
|
def css(text)
|
20
22
|
@a0.find.css(text).text
|
23
|
+
rescue => exception
|
24
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
21
25
|
end
|
22
26
|
|
23
27
|
def link(text, n: 1, all: false, visible: true)
|
24
28
|
@a0.find.link(text, n: n, all: all, visible: visible).text
|
29
|
+
rescue => exception
|
30
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
25
31
|
end
|
26
32
|
|
27
33
|
def button(text, n: 1, all: false, visible: true)
|
28
34
|
@a0.find.button(text, n: n, all: all, visible: visible).text
|
35
|
+
rescue => exception
|
36
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
29
37
|
end
|
30
38
|
|
31
39
|
def on(text, n: 1, all: false, visible: true)
|
32
40
|
@a0.find.on(text, n: n, all: all, visible: visible).text
|
41
|
+
rescue => exception
|
42
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
33
43
|
end
|
34
44
|
|
35
45
|
def option(text, n: 1, all: false, visible: true)
|
36
46
|
@a0.find.option(text, n: n, all: all, visible: visible).text
|
47
|
+
rescue => exception
|
48
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
37
49
|
end
|
38
50
|
|
39
51
|
def xpath(text, n: 1, all: false, visible: true)
|
40
52
|
@a0.find.xpath(text, n: n, all: all, visible: visible).text
|
53
|
+
rescue => exception
|
54
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
41
55
|
end
|
42
56
|
|
43
57
|
def page_title
|
44
58
|
@a0.driver.title
|
59
|
+
rescue => exception
|
60
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
45
61
|
end
|
46
62
|
end
|
47
63
|
end
|
data/lib/webdrone/version.rb
CHANGED
data/lib/webdrone/vrfy.rb
CHANGED
@@ -14,30 +14,44 @@ module Webdrone
|
|
14
14
|
|
15
15
|
def id(text, attr: nil, eq: nil, contains: nil)
|
16
16
|
vrfy @a0.find.id(text), attr: attr, eq: eq, contains: contains
|
17
|
+
rescue => exception
|
18
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
17
19
|
end
|
18
20
|
|
19
21
|
def css(text, attr: nil, eq: nil, contains: nil)
|
20
22
|
vrfy @a0.find.css(text), attr: attr, eq: eq, contains: contains
|
23
|
+
rescue => exception
|
24
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
21
25
|
end
|
22
26
|
|
23
27
|
def link(text, n: 1, visible: true, attr: nil, eq: nil, contains: nil)
|
24
28
|
vrfy @a0.find.link(text, n: n, visible: visible), attr: attr, eq: eq, contains: contains
|
29
|
+
rescue => exception
|
30
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
25
31
|
end
|
26
32
|
|
27
33
|
def button(text, n: 1, visible: true, attr: nil, eq: nil, contains: nil)
|
28
34
|
vrfy @a0.find.button(text, n: n, visible: visible), attr: attr, eq: eq, contains: contains
|
35
|
+
rescue => exception
|
36
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
29
37
|
end
|
30
38
|
|
31
39
|
def on(text, n: 1, visible: true, attr: nil, eq: nil, contains: nil)
|
32
40
|
vrfy @a0.find.on(text, n: n, visible: visible), attr: attr, eq: eq, contains: contains
|
41
|
+
rescue => exception
|
42
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
33
43
|
end
|
34
44
|
|
35
45
|
def option(text, n: 1, visible: true, attr: nil, eq: nil, contains: nil)
|
36
46
|
vrfy @a0.find.option(text, n: n, visible: visible), attr: attr, eq: eq, contains: contains
|
47
|
+
rescue => exception
|
48
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
37
49
|
end
|
38
50
|
|
39
51
|
def xpath(text, n: 1, visible: true, attr: nil, eq: nil, contains: nil)
|
40
52
|
vrfy @a0.find.xpath(text, n: n, visible: visible), attr: attr, eq: eq, contains: contains
|
53
|
+
rescue => exception
|
54
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
41
55
|
end
|
42
56
|
|
43
57
|
def vrfy(item, attr: nil, eq: nil, contains: nil)
|
data/lib/webdrone/wait.rb
CHANGED
@@ -25,10 +25,14 @@ module Webdrone
|
|
25
25
|
else
|
26
26
|
yield
|
27
27
|
end
|
28
|
+
rescue => exception
|
29
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
28
30
|
end
|
29
31
|
|
30
32
|
def time(val)
|
31
33
|
sleep val
|
34
|
+
rescue => exception
|
35
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
32
36
|
end
|
33
37
|
end
|
34
38
|
end
|
data/lib/webdrone/xlsx.rb
CHANGED
@@ -29,6 +29,8 @@ module Webdrone
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
@dict
|
32
|
+
rescue => exception
|
33
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
32
34
|
end
|
33
35
|
|
34
36
|
def rows(sheet: nil, filename: nil)
|
@@ -44,6 +46,8 @@ module Webdrone
|
|
44
46
|
end
|
45
47
|
end
|
46
48
|
@rows
|
49
|
+
rescue => exception
|
50
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
47
51
|
end
|
48
52
|
|
49
53
|
def both(sheet: nil, filename: nil)
|
@@ -67,6 +71,8 @@ module Webdrone
|
|
67
71
|
end
|
68
72
|
end
|
69
73
|
@both
|
74
|
+
rescue => exception
|
75
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
70
76
|
end
|
71
77
|
|
72
78
|
|
@@ -110,10 +116,14 @@ module Webdrone
|
|
110
116
|
end
|
111
117
|
k = workbook.write(@filename)
|
112
118
|
reset
|
119
|
+
rescue => exception
|
120
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
113
121
|
end
|
114
122
|
|
115
123
|
def reset()
|
116
124
|
@dict = @rows = @both = nil
|
125
|
+
rescue => exception
|
126
|
+
Webdrone.report_error(@a0, exception, Kernel.caller_locations)
|
117
127
|
end
|
118
128
|
|
119
129
|
protected
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webdrone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aldrin Martoq
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/webdrone/clic.rb
|
160
160
|
- lib/webdrone/conf.rb
|
161
161
|
- lib/webdrone/ctxt.rb
|
162
|
+
- lib/webdrone/error.rb
|
162
163
|
- lib/webdrone/exec.rb
|
163
164
|
- lib/webdrone/find.rb
|
164
165
|
- lib/webdrone/form.rb
|