locatine 0.02432 → 0.02535

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2938862d7ec4f9e5db28711a7f40764d1911ea73
4
- data.tar.gz: e6a0775a26dd2d7bd5516a8b0b198a6f4d4f7097
3
+ metadata.gz: 47bfe24e1d440f14261360ee0a4b262a7b495624
4
+ data.tar.gz: ac4af7f07c3db70cbbb745cc68702701f97e442a
5
5
  SHA512:
6
- metadata.gz: 131784b53b1c62a289587e7c7fc8faf44abce5d5121ecbd08aa6c58a2bfce1bdd05712d31aa9e2e3cafc3f76d4a390728c41a96da0635ad1b4ae44573737a858
7
- data.tar.gz: 0c80e987bb31e5991dc917849b4069d727f6f4902688e975a03c9248f6823e827b59545f0ed59e49b78dcd400f501d097db064ee51a87a518a07532628173e29
6
+ metadata.gz: 62e7a41f9b48b5187bff739b44591632e4a0e98dd69ec72f1683eaeca4d48347d16c78aeb97082db53d7d2a32ba38d743d0abc0dc7f4a7fb330ba86fd5203b4f
7
+ data.tar.gz: be450e5dd42e70b9fc0050c5349932fe43901377d35ef2d6c719fabc22419e2dc80eabb4f3415f3133e58fcc6a1d7cd0c9d6cb2cb5148f9a4a7fd1d642d62173
data/README.md CHANGED
@@ -16,7 +16,7 @@ That's it.
16
16
 
17
17
  ## Stage of development:
18
18
 
19
- Version of Locatine is **0.02432** only. It means so far this is an alfa. You can use it in a real project if you are a risky person.
19
+ Version of Locatine is **0.02535** only. It means so far this is an alfa. You can use it in a real project if you are a risky person.
20
20
 
21
21
  ## Installation
22
22
 
@@ -155,6 +155,18 @@ If you are sure that some attribute (or something) is not good(generated by rand
155
155
 
156
156
  On the other hand you can force locatine to always trust something with trusted.
157
157
 
158
+ ### autolearn
159
+
160
+ Determines wether Locatine will study elements by default or not.
161
+
162
+ If true Locatine will always check element for changes even if it is found properly (to catch for example adding of a new attribute). This is slow.
163
+
164
+ If false Locatine will study element only in case when it is lost.
165
+
166
+ If not stated Locatine will use false until it is not facing any lost element. After the first lost element it will be studying everything (true).
167
+
168
+ Notice that if autolearn is false Locatine is not bumping the stability values of attributes for elements which were found normally.
169
+
158
170
  ## Changing options on fly
159
171
 
160
172
  You can get or set these values on fly. Like:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Locatine app",
3
- "version": "0.02432",
3
+ "version": "0.02535",
4
4
  "description": "Messaging from browser to main app",
5
5
  "devtools_page": "devtools.html",
6
6
  "permissions": ["activeTab", "storage", "contextMenus", "tabs"],
@@ -9,13 +9,14 @@ module Locatine
9
9
  depth: 3,
10
10
  browser: nil,
11
11
  learn: ENV['LEARN'].nil? ? false : true,
12
- stability_limit: 1000,
12
+ stability_limit: 10,
13
13
  scope: 'Default',
14
14
  tolerance: 67,
15
15
  visual_search: false,
16
16
  no_fail: false,
17
17
  trusted: [],
18
- untrusted: []
18
+ untrusted: [],
19
+ autolearn: nil
19
20
  }
20
21
  end
21
22
 
@@ -15,6 +15,8 @@ module Locatine
15
15
  result = find_by_data(@data[scope][name], vars)
16
16
  attributes = generate_data(result, vars) if result
17
17
  if !result && !exact
18
+ @autolearn = true if @autolearn.nil?
19
+ @save = true
18
20
  result, attributes = find_by_magic(name, scope,
19
21
  @data[scope][name], vars)
20
22
  end
@@ -29,9 +31,10 @@ module Locatine
29
31
  end
30
32
 
31
33
  def full_search(name, scope, vars, locator, exact)
34
+ @save = @autolearn
32
35
  result, attributes = search_steps(name, scope, vars, locator, exact)
33
36
  raise_not_found(name, scope) if !result && !@current_no_f
34
- store(attributes, scope, name) if result
37
+ store(attributes, scope, name) if result && (@save || @learn)
35
38
  return result, attributes
36
39
  end
37
40
 
@@ -19,8 +19,8 @@ module Locatine
19
19
  # +learn+ shows will locatine ask for assistance from user or will fail
20
20
  # on error. learn is true when LEARN parameter is set in environment.
21
21
  #
22
- # +stability_limit+ shows max times attribute should be present to
23
- # consider it trusted.
22
+ # +stability_limit+ shows max times attribute should be present and
23
+ # checked to consider it trusted.
24
24
  #
25
25
  # +scope+ will be used in search (if not provided) defaulkt is "Default"
26
26
  #
@@ -38,6 +38,11 @@ module Locatine
38
38
  #
39
39
  # +untrusted+ array of names of attributes and element params to use
40
40
  # in search never.
41
+ #
42
+ # +autolearn+ determines will locatine study an element or not. true means
43
+ # locatine will always study it (slow). false means it won't study it
44
+ # unless it was lost and found. If not stated locatine will turn set it
45
+ # true if at least one element was lost.
41
46
  def initialize(config = {})
42
47
  init_config = default_init_config.merge(config)
43
48
  import_browser init_config.delete :browser
@@ -59,7 +59,8 @@ module Locatine
59
59
  :visual_search,
60
60
  :no_fail,
61
61
  :trusted,
62
- :untrusted
62
+ :untrusted,
63
+ :autolearn
63
64
  attr_reader :json,
64
65
  :browser
65
66
  end
@@ -1,6 +1,6 @@
1
1
  module Locatine
2
2
  # constants here...
3
- VERSION = '0.02432'.freeze
3
+ VERSION = '0.02535'.freeze
4
4
  NAME = 'locatine'.freeze
5
5
  HOME = if File.readable?("#{Dir.pwd}/lib/#{Locatine::NAME}")
6
6
  "#{Dir.pwd}/lib/#{Locatine::NAME}"
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.02432'
4
+ version: '0.02535'
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-06-14 00:00:00.000000000 Z
11
+ date: 2019-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '6.16'
83
- - !ruby/object:Gem::Dependency
84
- name: json
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '2.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: webdrivers
99
85
  requirement: !ruby/object:Gem::Requirement