locatine 0.02542 → 0.02637
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/locatine/app/content.css +1 -6
- data/lib/locatine/app/content.js +20 -17
- data/lib/locatine/app/manifest.json +1 -1
- data/lib/locatine/for_search/find_by_magic.rb +2 -2
- data/lib/locatine/for_search/listening.rb +1 -1
- data/lib/locatine/for_search/saying.rb +8 -5
- data/lib/locatine/for_search/xpath_generator.rb +9 -1
- data/lib/locatine/version.rb +1 -1
- 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: 8d969a9d3fc96c105d69b1d41f7ff8df92198d6d
|
4
|
+
data.tar.gz: 93ec07af0558fd08a13224686c9844775f3b36c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f7d7af25a50b8aeb293f3795574999e87debe5adfd3149bb3e9855257a5cf4f47c2f980c57a8582b7b65890abafc665c3d96ab39604eb4ae615bdc636489d11
|
7
|
+
data.tar.gz: 3883f1e882b88f038dcacd6520d408126e9c82b9178a5cfb2d5069d4b14a7327e25651d08a45ab447f8b4a0366341482aefc7414668d06e08aeebaa13ef2ffd0
|
data/README.md
CHANGED
@@ -16,7 +16,11 @@ That's it.
|
|
16
16
|
|
17
17
|
## Stage of development:
|
18
18
|
|
19
|
-
Version of Locatine is **0.
|
19
|
+
Version of Locatine is **0.02637** only. It means so far this is an alfa. You can use it in a real project if you are a risky person.
|
20
|
+
|
21
|
+
## Attention
|
22
|
+
|
23
|
+
Beginning with the next version locatine (especially locatine-daemon) will be refactored dramatically. It is highly possible that the next version will be not completable with that one.
|
20
24
|
|
21
25
|
## Installation
|
22
26
|
|
@@ -20,7 +20,7 @@ div[locatinestyle=true] {
|
|
20
20
|
display: block;
|
21
21
|
z-index: 2147483646;
|
22
22
|
color: #FF99AA;
|
23
|
-
font-size:
|
23
|
+
font-size: 4vw;
|
24
24
|
text-align: center;
|
25
25
|
cursor: default;
|
26
26
|
}
|
@@ -30,11 +30,6 @@ div[locatinestyle=false] {
|
|
30
30
|
width: 0%;
|
31
31
|
}
|
32
32
|
|
33
|
-
div[locatinestyle=blocked] {
|
34
|
-
height: 0%;
|
35
|
-
width: 0%;
|
36
|
-
}
|
37
|
-
|
38
33
|
[locatineclass=foundbylocatine]
|
39
34
|
{animation: locatine_found 6s infinite;
|
40
35
|
-webkit-appearance: none;
|
data/lib/locatine/app/content.js
CHANGED
@@ -46,21 +46,24 @@ async function setTitleHint(magicDiv){
|
|
46
46
|
await set_value('locatine_title', magicDiv.getAttribute("locatinetitle"));
|
47
47
|
await set_value('locatine_hint', magicDiv.getAttribute("locatinehint"));
|
48
48
|
magicDiv.setAttribute("locatinetitle", "ok");
|
49
|
-
let
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
49
|
+
let status = await get_value('magic_div');
|
50
|
+
if (status) {
|
51
|
+
let op = 1;
|
52
|
+
magicDiv.innerHTML = await get_value("locatine_title");
|
53
|
+
let timer = setInterval(function () {
|
54
|
+
if ((magicDiv.style.opacity == 1) && (op < 0.97)) {
|
55
|
+
clearInterval(timer);// If other process changed opacity.
|
56
|
+
};
|
57
|
+
if (op <= 0.2) {
|
58
|
+
clearInterval(timer);
|
59
|
+
magicDiv.style.opacity = 0;
|
60
|
+
magicDiv.innerHTML = "";
|
61
|
+
}
|
62
|
+
magicDiv.style.opacity = op;
|
63
|
+
magicDiv.style.filter = 'alpha(opacity=' + op * 100 + ")";
|
64
|
+
op -= op * 0.03;
|
65
|
+
}, 50);
|
66
|
+
}
|
64
67
|
}
|
65
68
|
}
|
66
69
|
|
@@ -117,7 +120,7 @@ async function getSelected(value){
|
|
117
120
|
};
|
118
121
|
|
119
122
|
async function locatine_magic_click(e) {
|
120
|
-
document.getElementById("locatine_magic_div").setAttribute("locatinestyle", "
|
123
|
+
document.getElementById("locatine_magic_div").setAttribute("locatinestyle", "false");
|
121
124
|
const value = document.elementFromPoint(e.clientX, e.clientY);
|
122
125
|
document.getElementById("locatine_magic_div").setAttribute("locatinestyle", "true");
|
123
126
|
const tagName = value.tagName;
|
@@ -140,7 +143,7 @@ function locatine_create_element(dom, tag, attrs, inner) {
|
|
140
143
|
|
141
144
|
setInterval(async function(){
|
142
145
|
if (document.getElementById("locatine_magic_div")) {
|
143
|
-
if (document.getElementById("locatine_magic_div").getAttribute("locatinestyle") != "
|
146
|
+
if (document.getElementById("locatine_magic_div").getAttribute("locatinestyle") != "false") {
|
144
147
|
await refreshData()
|
145
148
|
}
|
146
149
|
} else {
|
@@ -28,7 +28,7 @@ module Locatine
|
|
28
28
|
# We are taking every element that look at least a bit similar to one we
|
29
29
|
# are looking for
|
30
30
|
def magic_elements(name, scope, data, vars, page)
|
31
|
-
warn_element_lost(name, scope)
|
31
|
+
warn_element_lost(name, scope, data, vars)
|
32
32
|
all = select_from_page(page, data, vars)
|
33
33
|
raise_not_found(name, scope) if all.empty? && !@current_no_f
|
34
34
|
suggested = most_common_of(all).map do |element|
|
@@ -54,7 +54,7 @@ module Locatine
|
|
54
54
|
ok = similar_enough(data, attributes) unless suggest.empty?
|
55
55
|
raise_not_similar(name, scope) if !ok && !@current_no_f
|
56
56
|
if ok
|
57
|
-
warn_lost_found(name, scope)
|
57
|
+
warn_lost_found(name, scope, attributes, vars)
|
58
58
|
return suggest, attributes
|
59
59
|
end
|
60
60
|
warn_not_found(name, scope)
|
@@ -21,7 +21,7 @@ module Locatine
|
|
21
21
|
##
|
22
22
|
# Sending request to locatine app
|
23
23
|
def start_listening(scope, name)
|
24
|
-
send_to_app('locatinestyle', '
|
24
|
+
send_to_app('locatinestyle', 'set_false', @browser) if @iframe
|
25
25
|
send_to_app('locatinestyle', 'set_true')
|
26
26
|
send_to_app('locatineconfirmed', 'ok')
|
27
27
|
send_selecting(name, scope)
|
@@ -128,9 +128,10 @@ module Locatine
|
|
128
128
|
' :links, etc.)'
|
129
129
|
end
|
130
130
|
|
131
|
-
def warn_element_lost(name, scope)
|
132
|
-
|
133
|
-
|
131
|
+
def warn_element_lost(name, scope, data, vars)
|
132
|
+
xpath = generate_xpath(data, vars)
|
133
|
+
send_warn "#{name} in #{scope} by xpath: ```#{xpath}``` is//are lost."\
|
134
|
+
' Locatine is trying to find it anyway.'
|
134
135
|
end
|
135
136
|
|
136
137
|
def warn_cannot_highlight(data)
|
@@ -154,8 +155,10 @@ module Locatine
|
|
154
155
|
send_warn "Only the first 50 elements of #{size} were highlighted."
|
155
156
|
end
|
156
157
|
|
157
|
-
def warn_lost_found(name, scope)
|
158
|
-
|
158
|
+
def warn_lost_found(name, scope, data, vars)
|
159
|
+
xpath = generate_xpath(data, vars)
|
160
|
+
send_warn "Something was found as #{name} in #{scope} by xpath:"\
|
161
|
+
"```#{xpath}```"
|
159
162
|
end
|
160
163
|
|
161
164
|
def warn_not_found(name, scope)
|
@@ -34,7 +34,15 @@ module Locatine
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def generate_xpath_part(hash, vars)
|
37
|
-
|
37
|
+
result = ''
|
38
|
+
values = process_string(hash['value'], vars).split(/[,.-_ ;'\\"]/)
|
39
|
+
values.each do |value|
|
40
|
+
result += generate_real_xpath_part(hash, value) if !value.empty?
|
41
|
+
end
|
42
|
+
result
|
43
|
+
end
|
44
|
+
|
45
|
+
def generate_real_xpath_part(hash, value)
|
38
46
|
case hash['type']
|
39
47
|
when 'tag'
|
40
48
|
"[self::#{value}]"
|
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.02637'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei Seleznev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|