browza 0.0.3.5 → 0.0.4

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: f983a337a1b7146221706bd8d54d33b56cbb856f
4
- data.tar.gz: 6a615acd4c669276346150fda66c7deddfa5e22f
3
+ metadata.gz: cc4756e03d74208e056664cb495cbe9caf4ca25b
4
+ data.tar.gz: e7f638d1e4645105d9aed6ffc9a0e1f534669919
5
5
  SHA512:
6
- metadata.gz: d1cf85e46807e238bde0da24cbb85e8d5d54f46848012a61f66303840a66ccd5fa4c5e055a8ac379699ee2e34fbb774d7f894dac92b9fed816f4c6d14c4f9cf4
7
- data.tar.gz: 7b7d0857929dfe378a311aa485cf27b7845d003e48060254fbb9f6984d139990713bcbe279e2494097bc34cd6c010e06f1872a6ba93b9de3fbad339b5d1e5629
6
+ metadata.gz: b0cf80c06efe95366ece1893d3190e6c4fca6983539a7d6a9f14c0becf1adba00246de4874d12a1b78a19e1794bb1a8b61f17f81c3172f9b701f0527e1689055
7
+ data.tar.gz: 401f348eefc34a1e406eca566e7f34773b5c2dd7ec06085fe5e5ed94a3fbd53ef9cd1d6560f1a45524b0542c1ffd0530bfe13a1db40bd07108bf483a152ff98e
@@ -9,7 +9,6 @@ module Browza
9
9
  class Manager
10
10
 
11
11
  include Singleton
12
- include Singleton
13
12
 
14
13
  attr_accessor :drv
15
14
  attr_accessor :appModels
@@ -31,6 +30,10 @@ class Manager
31
30
  @browserMgr = Browza::BrowzaMgr.new()
32
31
  end
33
32
 
33
+ def setDebug(b)
34
+ @debug = b
35
+ end
36
+
34
37
  def _addDriver(d)
35
38
  @logger.debug __FILE__ + (__LINE__).to_s + " _addDriver(#{d})" if @debug
36
39
  @browserMgr.add(d)
@@ -102,8 +105,10 @@ class Manager
102
105
 
103
106
  if caps['platform'].match(/\s*(linux|macOS|osx|os x|windows)/i)
104
107
 
105
- if caps.has_key?('browserType')
106
- browserType = caps['browserType']
108
+ if caps.has_key?('browserType') || ENV['SELENIUM_BROWSER']
109
+ browserType = caps['browserType'] || ENV['SELENIUM_BROWSER']
110
+
111
+ @logger.debug " browserType: #{browserType}"
107
112
 
108
113
  if browserType.match(/edge/i)
109
114
  caps = Selenium::WebDriver::Remote::Capabilities.edge()
@@ -147,7 +152,7 @@ class Manager
147
152
 
148
153
  _addDriver( { :id => id, :drv => @drv, :is_sauce => !runLocal })
149
154
  rescue => ex
150
- @logger.fatal __FILE__ + (__LINE__).to_s + " #{ex.class}"
155
+ @logger.fatal __FILE__ + (__LINE__).to_s + " #{ex.class} : #{ex}"
151
156
  @logger.fatal "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
152
157
  end
153
158
 
@@ -254,9 +259,6 @@ class Manager
254
259
  _height = 768
255
260
  end
256
261
 
257
-
258
-
259
-
260
262
  @logger.debug __FILE__ + (__LINE__).to_s + " createBrowser() : width x height : #{_width}, #{_height}" if @debug
261
263
 
262
264
  _id = Time.now.to_i.to_s
@@ -896,13 +898,18 @@ class Manager
896
898
 
897
899
  obj = findLocator(_locator)
898
900
 
899
- scrollElementIntoMiddle = "var viewPortHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);" +
900
- "var elementTop = arguments[0].getBoundingClientRect().top;" +
901
- "window.scrollBy(0, elementTop-(viewPortHeight/2) + 150);";
901
+ if !obj.nil?
902
+
903
+ scrollElementIntoMiddle = "var viewPortHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);" +
904
+ "var elementTop = arguments[0].getBoundingClientRect().top;" +
905
+ "window.scrollBy(0, elementTop-(viewPortHeight/2) + 150);";
906
+
907
+ drv.execute_script("arguments[0].scrollIntoView(true);", obj);
908
+ # drv.action.move_to(obj).perform
909
+ # drv.execute_script(scrollElementIntoMiddle, obj)
910
+
911
+ end
902
912
 
903
- drv.execute_script("arguments[0].scrollIntoView(true);", obj);
904
- drv.action.move_to(obj).perform
905
- # drv.execute_script(scrollElementIntoMiddle, obj)
906
913
 
907
914
  end
908
915
 
@@ -1332,6 +1339,19 @@ class Manager
1332
1339
  rc
1333
1340
  end
1334
1341
 
1342
+ def getStyle(_locator, _attr)
1343
+ attr = nil
1344
+
1345
+ begin
1346
+ obj = findLocator(_locator)
1347
+ attr = obj.style(_attr)
1348
+ rescue => ex
1349
+ ;
1350
+ end
1351
+
1352
+ attr
1353
+ end
1354
+
1335
1355
  def getText(_locator)
1336
1356
  @logger.debug __FILE__ + (__LINE__).to_s + " getText?(#{_locator})"
1337
1357
  rc = false
@@ -1,3 +1,3 @@
1
1
  module Browza
2
- VERSION = "0.0.3.5"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browza
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.5
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - H20Dragon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-20 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler