locatine 0.00506 → 0.00552
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/locatine/search.rb +14 -6
- 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: e57e23979fb3a69439e1bd692a22568d47654178
|
|
4
|
+
data.tar.gz: 02d220e1a0cd3ae905516c0e488cec37858e9484
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8fdd5b8d9e841b3b08de8b2611c24d9402866b4b523f84b1741cfbf0f7618a987e538cf45b54c1a56bb8a8372598feaef8f25822157d2d56b0539f002a2fcc1f
|
|
7
|
+
data.tar.gz: 56cd9562f131ba2b52d9a7bcb2e6cf45d335c83acdbc50c2808f685aadbe2295d0d9b3704a9b8e923f1b3350a5e9699fee486b5897aa226b5993f5d87a99011c
|
data/lib/locatine/search.rb
CHANGED
|
@@ -2,7 +2,6 @@ require "watir"
|
|
|
2
2
|
require "json"
|
|
3
3
|
require "fileutils"
|
|
4
4
|
require "chromedriver-helper"
|
|
5
|
-
require "pry"
|
|
6
5
|
|
|
7
6
|
module Locatine
|
|
8
7
|
|
|
@@ -172,8 +171,12 @@ module Locatine
|
|
|
172
171
|
end
|
|
173
172
|
|
|
174
173
|
def get_trusted(array)
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
if array.length > 0
|
|
175
|
+
max_stability = (array.max_by {|i| i["stability"].to_i})["stability"].to_i
|
|
176
|
+
return (array.select {|i| i["stability"].to_i == max_stability}).uniq
|
|
177
|
+
else
|
|
178
|
+
return []
|
|
179
|
+
end
|
|
177
180
|
end
|
|
178
181
|
|
|
179
182
|
def generate_xpath(data, vars)
|
|
@@ -310,7 +313,8 @@ module Locatine
|
|
|
310
313
|
max = all.count(all.max_by {|i| all.count(i)})
|
|
311
314
|
guess = (all.select {|i| all.count(i) == max}).uniq
|
|
312
315
|
guess_data = generate_data(guess, vars)
|
|
313
|
-
|
|
316
|
+
by_data = find_by_data(guess_data, vars)
|
|
317
|
+
if by_data.nil? || (engine.elements.length/find_by_data(guess_data, vars).length <=4)
|
|
314
318
|
puts "Locatine has no good guess for #{name} in #{scope}. Try to change the name. Or just define it."
|
|
315
319
|
guess = nil
|
|
316
320
|
guess_data = {}
|
|
@@ -350,13 +354,17 @@ module Locatine
|
|
|
350
354
|
if old_element != element
|
|
351
355
|
mass_highlight_turn(old_element, false) if old_element
|
|
352
356
|
mass_highlight_turn(element) if element
|
|
353
|
-
|
|
357
|
+
if element.nil?
|
|
358
|
+
puts "Nothing is selected as #{name} in #{scope}"
|
|
359
|
+
else
|
|
360
|
+
puts "#{element.length} elements were selected as #{name} in #{scope}"
|
|
361
|
+
end
|
|
354
362
|
end
|
|
355
363
|
old_element, old_tag, old_index = element, tag, index
|
|
356
364
|
case get_from_app("locatineconfirmed")
|
|
357
365
|
when "true"
|
|
358
366
|
send_to_app("locatineconfirmed", "ok")
|
|
359
|
-
send_to_app("locatinetitle", "
|
|
367
|
+
send_to_app("locatinetitle", "Right now you are defining nothing. So no button will work")
|
|
360
368
|
send_to_app("locatinehint", "Place for a smart hint here")
|
|
361
369
|
finished = true
|
|
362
370
|
when "declined"
|
data/lib/locatine/version.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Locatine
|
|
2
2
|
# constants here...
|
|
3
|
-
VERSION = "0.
|
|
3
|
+
VERSION = "0.00552"
|
|
4
4
|
NAME = "locatine"
|
|
5
5
|
HOME = File.readable?("#{Dir.pwd}/lib/#{Locatine::NAME}")? "#{Dir.pwd}/lib/#{Locatine::NAME}" : "#{Gem.dir}/gems/#{Locatine::NAME}-#{Locatine::VERSION}/lib/#{Locatine::NAME}"
|
|
6
6
|
end
|
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.00552'
|
|
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-03-
|
|
11
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|