locatine 0.03118 → 0.03143
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/lib/locatine/daemon.rb +1 -1
- data/lib/locatine/element.rb +11 -0
- data/lib/locatine/results.rb +5 -1
- data/lib/locatine/session.rb +9 -1
- data/lib/locatine/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38cf69f2ca475f5755477d3bf3ea25581edf0a4a1a57b6491e70f4b97073541b
|
4
|
+
data.tar.gz: 22eeccf122ed564e802047874710fb85f234d4ba52c03a89b8b3ad8e20d0a2cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e637591dbc8f53827fd59747dc45675674350f0ed03985b22524b8f9b0b0b705ba60006e5575ee37b2e0c0c51fa8109bf459381fcc11fd96d51120bf2c31da40
|
7
|
+
data.tar.gz: 2b1461b445491aa49a94a725431e2a4cec9d41bbc5d46e6c6570792297f21987e887c930f17285f65e3782bc4fcc4cef9f4490fd6ee62f0e9b6c85f177f82355
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ That's it.
|
|
14
14
|
|
15
15
|
## Stage of development:
|
16
16
|
|
17
|
-
Version of Locatine is **0.
|
17
|
+
Version of Locatine is **0.03143**.
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
@@ -48,14 +48,16 @@ driver.quit
|
|
48
48
|
4. Run the locatine daemon
|
49
49
|
|
50
50
|
```
|
51
|
-
$
|
51
|
+
$ locatine-daemon.rb --port=7733 --selenium="http://localhost:4444"
|
52
52
|
```
|
53
53
|
|
54
|
-
5.
|
54
|
+
5. *--selenium* - is for url where selenium hub is started, *--port* is the port for your code to connect. 4444 and 7733 are defaults.
|
55
55
|
6. Run your code
|
56
56
|
7. Data of element will be stored to ./default.json file.
|
57
57
|
8. Now if id of your element is changed on the page Locatine will show a warning and gonna try to retrieve it.
|
58
|
-
9. See [
|
58
|
+
9. See [examples](https://github.com/sseleznevqa/locatine/tree/master/examples) to see how it really works.
|
59
|
+
|
60
|
+
**NOTE!** All examples in readme are ruby language examples. But any language can be successfully used. You can find Python example using the link above.
|
59
61
|
|
60
62
|
## Session
|
61
63
|
|
data/lib/locatine/daemon.rb
CHANGED
data/lib/locatine/element.rb
CHANGED
@@ -44,5 +44,16 @@ module Locatine
|
|
44
44
|
@info = @session.execute_script(info, self)
|
45
45
|
@info
|
46
46
|
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Method to get tag of the particular element or return it if it was
|
50
|
+
# gathered before
|
51
|
+
def tag_name
|
52
|
+
return @tag if @tag
|
53
|
+
|
54
|
+
script = 'return arguments[0].tagName'
|
55
|
+
@tag = @session.execute_script(script, self)
|
56
|
+
@tag
|
57
|
+
end
|
47
58
|
end
|
48
59
|
end
|
data/lib/locatine/results.rb
CHANGED
@@ -69,7 +69,11 @@ module Locatine
|
|
69
69
|
guess if name_only?
|
70
70
|
return if first.class == Locatine::Error || empty?
|
71
71
|
|
72
|
-
|
72
|
+
check_guess if name_only?
|
73
|
+
end
|
74
|
+
|
75
|
+
def check_guess
|
76
|
+
map(&:tag_name).uniq.size == 1 ? log_found : clear
|
73
77
|
end
|
74
78
|
|
75
79
|
def simple_find
|
data/lib/locatine/session.rb
CHANGED
@@ -53,12 +53,13 @@ module Locatine
|
|
53
53
|
# @return populated instance of Locatine::Results or an empty array
|
54
54
|
# or Locatine::Error
|
55
55
|
def find(params, parent = nil)
|
56
|
+
@start_time = Time.now
|
56
57
|
find_routine(params, parent)
|
57
58
|
rescue RuntimeError => e
|
58
59
|
raise e.message unless e.message == 'stale element reference'
|
59
60
|
|
60
61
|
warn_unstable_page
|
61
|
-
|
62
|
+
find_routine(params, parent)
|
62
63
|
end
|
63
64
|
|
64
65
|
##
|
@@ -134,8 +135,15 @@ module Locatine
|
|
134
135
|
end
|
135
136
|
end
|
136
137
|
|
138
|
+
def define_timeout(params)
|
139
|
+
params['timeout'] = params['timeout']
|
140
|
+
.to_i - (Time.now - @start_time).round
|
141
|
+
params
|
142
|
+
end
|
143
|
+
|
137
144
|
def find_routine(params, parent)
|
138
145
|
results = Results.new
|
146
|
+
params = define_timeout(params)
|
139
147
|
answer = results.find(self, params, parent)
|
140
148
|
if !answer.empty? && answer.first.class != Locatine::Error
|
141
149
|
@elements[results.name] = results.info
|
data/lib/locatine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locatine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.03143'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei Seleznev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,7 +128,7 @@ dependencies:
|
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0.8'
|
131
|
-
description: The main goal to write locators never
|
131
|
+
description: The main goal is to write locators (almost) never
|
132
132
|
email: s_seleznev_qa@hotmail.com
|
133
133
|
executables:
|
134
134
|
- locatine-daemon.rb
|
@@ -178,5 +178,5 @@ requirements: []
|
|
178
178
|
rubygems_version: 3.0.3
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
|
-
summary: Element locating
|
181
|
+
summary: Element locating proxy for selenium
|
182
182
|
test_files: []
|