wda_lib 0.0.20 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wda_lib/debug.rb +16 -7
- data/lib/wda_lib/session.rb +1 -1
- data/lib/wda_lib/touch_id.rb +1 -1
- data/lib/wda_lib/version.rb +1 -1
- data/lib/wda_lib.rb +6 -6
- 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: 221802f6fc6baa68274145fde265c911c7ca03c4
|
4
|
+
data.tar.gz: cb2140ff5d9055afc139c88702b6ec395367d9a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff14d99fdefaf1f88bb8eddc97e261eb05fb8c7dcb0b51768ff117a51f11f48bba77c8cfe299982567797671112732428bab68b655566b5137c678530d96cea6
|
7
|
+
data.tar.gz: 91195e8815e41f1eabeaa0c0b8ab2aa3a0d54d46a10f55181451316045aebac3cc1bb7a2c406aa6217a0ff3bf5b2aaa155cfe9c96ed466616ee9b26a4616996f
|
data/lib/wda_lib/debug.rb
CHANGED
@@ -6,18 +6,27 @@ class WDA
|
|
6
6
|
module Debug
|
7
7
|
|
8
8
|
# Get all elements on current screen
|
9
|
-
# @param session_id [String],
|
9
|
+
# @param session_id [String], not_fetch_inaccessible [Boolean], not_fetch_invisible [Boolean], timeout [Integer]
|
10
10
|
# When accessible is true, ignore all elements except for the main window for accessibility tree
|
11
11
|
# When accessible is false, and visible is true, ignore all invisible elements
|
12
12
|
# @return [Hash]
|
13
|
-
def source(session_id = nil,
|
14
|
-
if
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
def source(session_id = nil, not_fetch_inaccessible = true, not_fetch_invisible = true, timeout = 60)
|
14
|
+
@timeout = timeout.to_i if !timeout.nil?
|
15
|
+
begin
|
16
|
+
if session_id.nil?
|
17
|
+
res = post(@base_url + '/source', { accessible: not_fetch_inaccessible, visible: not_fetch_invisible }, @timeout)
|
18
|
+
else
|
19
|
+
res = post('/source', { accessible: not_fetch_inaccessible, visible: not_fetch_invisible }, @timeout)
|
20
|
+
end
|
21
|
+
rescue
|
22
|
+
raise Error::NoSuchElementError, "Can't fetch current screen elements within #{@timeout}s" if res['status'].nil?
|
23
|
+
end
|
24
|
+
@timeout = @default_timeout
|
25
|
+
res
|
19
26
|
end
|
20
27
|
|
28
|
+
|
29
|
+
|
21
30
|
def get_source
|
22
31
|
get(@base_url + '/source')['value']['tree']['children']
|
23
32
|
end
|
data/lib/wda_lib/session.rb
CHANGED
@@ -8,7 +8,7 @@ class WDA
|
|
8
8
|
# Get current status
|
9
9
|
# @return [Obj]
|
10
10
|
def status
|
11
|
-
@status = get(@base_url + '/status')
|
11
|
+
@status = get(@base_url + '/status', 5)
|
12
12
|
@platform_name = @status['value']['os']['name']
|
13
13
|
@platform_version = @status['value']['os']['version']
|
14
14
|
update_status(@status)
|
data/lib/wda_lib/touch_id.rb
CHANGED
data/lib/wda_lib/version.rb
CHANGED
data/lib/wda_lib.rb
CHANGED
@@ -96,19 +96,19 @@ class WDA
|
|
96
96
|
# HTTP methods for dealing with all supported motheds in FB WDA
|
97
97
|
# I don't like to write such pieces of code, it removes all query params and headers,
|
98
98
|
# But as FB WDA is doing like this, this can simplify codes
|
99
|
-
def get(path)
|
99
|
+
def get(path, timeout = 60)
|
100
100
|
if URI.parse(path).absolute?
|
101
|
-
WDA.get(path)
|
101
|
+
WDA.get(path, timeout: timeout)
|
102
102
|
else
|
103
|
-
WDA.get(@url + path)
|
103
|
+
WDA.get(@url + path, timeout: timeout)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
def post(path, body = nil)
|
107
|
+
def post(path, body = nil, timeout = 60)
|
108
108
|
if URI.parse(path).absolute?
|
109
|
-
WDA.post(path, body: body.to_json)
|
109
|
+
WDA.post(path, body: body.to_json, timeout: timeout)
|
110
110
|
else
|
111
|
-
WDA.post(@url + path, body: body.to_json)
|
111
|
+
WDA.post(@url + path, body: body.to_json, timeout: timeout)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
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.1.0
|
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-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|