wda_lib 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/selenium_patch/commands_patch.rb +22 -18
- data/lib/wda_lib/debug.rb +9 -1
- data/lib/wda_lib/version.rb +1 -1
- data/lib/wda_lib.rb +14 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19883542a4fe2fc7642ded024233e0b232f07d56
|
4
|
+
data.tar.gz: 2af914564729ff76ff75974d1a21907c269b27a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aae9e4320f23268979f7cc2aba7af70fd6a7c846da858ebeca93fca8302f4a8e33759b0044d0f94b758b210755b8799a0c30654b120d413d25758e06a60bea28
|
7
|
+
data.tar.gz: d9e6af8060a6d7f0451b6aeea05f2d14189ea04652b795b4b9562fb6cf68f893e261f90b4985858ade51479361869d157295b8da75a97136b18befd1f369acb6
|
@@ -10,24 +10,28 @@ module Selenium
|
|
10
10
|
#
|
11
11
|
# http://www.w3.org/TR/2015/WD-webdriver-20150918/#list-of-endpoints
|
12
12
|
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
13
|
+
patched_commands = {
|
14
|
+
get_page_source_json: [:get, 'source/json'.freeze],
|
15
|
+
get_page_source_xml: [:get, 'source/xml'.freeze],
|
16
|
+
session_status: [:get, 'status'.freeze],
|
17
|
+
get_element_rect: [:get, 'session/:session_id/element/:id/rect'.freeze],
|
18
|
+
is_element_accessible: [:get, 'session/:session_id/element/:id/accessible'.freeze],
|
19
|
+
element_accessibility_container: [:get, 'session/:session_id/element/:id/accessibilityContainer'.freeze],
|
20
|
+
double_click_element: [:post, 'session/:session_id/element/:id/doubleTap'.freeze],
|
21
|
+
two_finger_click_element: [:post, 'session/:session_id/element/:id/twoFingerTap'.freeze],
|
22
|
+
touch_and_hold_element: [:post, 'session/:session_id/element/:id/touchAndHold'.freeze],
|
23
|
+
scroll_element: [:post, 'session/:session_id/uiaElement/:id/scroll'.freeze],
|
24
|
+
drag_from_to_for_duration: [:post, 'session/:session_id/uiaTarget/:uuid/dragfromtoforduration'.freeze],
|
25
|
+
tap: [:post, 'session/:session_id/doubleTap/:id'.freeze],
|
26
|
+
tap_and_hold: [:post, 'session/:session_id/touchAndHold'.freeze],
|
27
|
+
double_tap: [:post, 'session/:session_id/doubleTap'.freeze]
|
28
|
+
}
|
29
|
+
|
30
|
+
PATCHED_COMMANDS = patched_commands.merge!(COMMANDS).freeze
|
31
|
+
|
32
|
+
def commands(command)
|
33
|
+
PATCHED_COMMANDS[command]
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end # Remote
|
33
37
|
end # WebDriver
|
data/lib/wda_lib/debug.rb
CHANGED
@@ -52,8 +52,16 @@ class WDA
|
|
52
52
|
end
|
53
53
|
|
54
54
|
app.nil?? (fail "Can't find app :#{app_name}") : app
|
55
|
-
|
56
55
|
end
|
57
56
|
|
57
|
+
def exists
|
58
|
+
exists = true
|
59
|
+
begin
|
60
|
+
yield # search for element
|
61
|
+
rescue
|
62
|
+
exists = false # error means it's not there
|
63
|
+
end
|
64
|
+
exists
|
65
|
+
end
|
58
66
|
end
|
59
67
|
end
|
data/lib/wda_lib/version.rb
CHANGED
data/lib/wda_lib.rb
CHANGED
@@ -27,7 +27,6 @@ class WDA
|
|
27
27
|
include ::WDA::Type
|
28
28
|
include ::WDA::Error
|
29
29
|
|
30
|
-
|
31
30
|
Point = Struct.new(:x, :y)
|
32
31
|
Dimension = Struct.new(:width, :height)
|
33
32
|
|
@@ -62,11 +61,12 @@ class WDA
|
|
62
61
|
@url = @base_url
|
63
62
|
@server_host = parsed_url.host
|
64
63
|
@server_port = parsed_url.port
|
65
|
-
@
|
64
|
+
@default_timeout = opts.fetch :default_timeout, 10
|
65
|
+
@timeout = @default_timeout
|
66
66
|
@listener = opts.fetch :listener, nil
|
67
67
|
status
|
68
68
|
window_size
|
69
|
-
|
69
|
+
capabilities(opts)
|
70
70
|
@http_client ||= Selenium::WebDriver::Remote::Http::Default.new(open_timeout: 999_999, read_timeout: 999_999)
|
71
71
|
@driver = Selenium::WebDriver.for(:remote,
|
72
72
|
http_client: @http_client,
|
@@ -115,4 +115,15 @@ class WDA
|
|
115
115
|
def delete(path)
|
116
116
|
WDA.delete(path)
|
117
117
|
end
|
118
|
+
|
119
|
+
def set_wait(timeout = nil)
|
120
|
+
if timeout.nil?
|
121
|
+
@timeout = @default_timeout
|
122
|
+
elsif timeout < 1
|
123
|
+
@timeout = 1
|
124
|
+
else
|
125
|
+
@timeout = timeout.to_i
|
126
|
+
end
|
127
|
+
return @timeout
|
128
|
+
end
|
118
129
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wda_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MIN Yi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|