browza 0.0.3.4 → 0.0.3.5
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/examples/fox.proxy.rb +12 -0
- data/lib/browza/base/manager.rb +66 -17
- data/lib/browza/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f983a337a1b7146221706bd8d54d33b56cbb856f
|
4
|
+
data.tar.gz: 6a615acd4c669276346150fda66c7deddfa5e22f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1cf85e46807e238bde0da24cbb85e8d5d54f46848012a61f66303840a66ccd5fa4c5e055a8ac379699ee2e34fbb774d7f894dac92b9fed816f4c6d14c4f9cf4
|
7
|
+
data.tar.gz: 7b7d0857929dfe378a311aa485cf27b7845d003e48060254fbb9f6984d139990713bcbe279e2494097bc34cd6c010e06f1872a6ba93b9de3fbad339b5d1e5629
|
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
require 'selenium-webdriver'
|
3
|
+
|
4
|
+
|
5
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
6
|
+
proxy = Selenium::WebDriver::Proxy.new(http: "127.0.0.:8080")
|
7
|
+
profile.proxy = proxy
|
8
|
+
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
|
9
|
+
driver = Selenium::WebDriver.for :firefox, options: options
|
10
|
+
|
11
|
+
|
12
|
+
|
data/lib/browza/base/manager.rb
CHANGED
@@ -231,6 +231,10 @@ class Manager
|
|
231
231
|
caps['version'] = ENV['SELENIUM_VERSION']
|
232
232
|
ENV['SELENIUM_RUN']='sauce'
|
233
233
|
|
234
|
+
if !ENV['SAUCE_TUNNEL_ID'].nil?
|
235
|
+
caps['tunnel-identifier'] = ENV['SAUCE_TUNNEL_ID'].to_s
|
236
|
+
end
|
237
|
+
|
234
238
|
connectSauce(caps['name'], caps)
|
235
239
|
end
|
236
240
|
|
@@ -250,6 +254,9 @@ class Manager
|
|
250
254
|
_height = 768
|
251
255
|
end
|
252
256
|
|
257
|
+
|
258
|
+
|
259
|
+
|
253
260
|
@logger.debug __FILE__ + (__LINE__).to_s + " createBrowser() : width x height : #{_width}, #{_height}" if @debug
|
254
261
|
|
255
262
|
_id = Time.now.to_i.to_s
|
@@ -325,13 +332,27 @@ class Manager
|
|
325
332
|
@logger.debug "Selenium::WebDriver.for #{@browserType} (isSymbol: #{@browserType.is_a?(Symbol)})" if @debug
|
326
333
|
|
327
334
|
begin
|
328
|
-
if timeout.nil?
|
335
|
+
if timeout.nil? && ENV['SELENIUM_PROXY'].nil?
|
329
336
|
@drv = Selenium::WebDriver.for @browserType
|
330
337
|
else
|
331
|
-
client = Selenium::WebDriver::Remote::Http::Default.new
|
332
|
-
client.read_timeout = timeout.to_i
|
333
338
|
|
334
|
-
|
339
|
+
if ENV['SELENIUM_PROXY']
|
340
|
+
|
341
|
+
if @browserType.to_s.match(/firefox/i)
|
342
|
+
@logger.debug "createBrowser() with proxy: #{ENV['SELENIUM_PROXY']}"
|
343
|
+
|
344
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
345
|
+
proxy = Selenium::WebDriver::Proxy.new(http: "#{ENV['SELENIUM_PROXY']}")
|
346
|
+
profile.proxy = proxy
|
347
|
+
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
|
348
|
+
@drv = Selenium::WebDriver.for :firefox, options: options
|
349
|
+
end
|
350
|
+
|
351
|
+
elsif
|
352
|
+
client = Selenium::WebDriver::Remote::Http::Default.new
|
353
|
+
client.read_timeout = timeout.to_i
|
354
|
+
@drv = Selenium::WebDriver.for @browserType, http_client: client
|
355
|
+
end
|
335
356
|
|
336
357
|
puts __FILE__ + (__LINE__).to_s + " Set NET::TIMEOUT to #{timeout.to_s}"
|
337
358
|
end
|
@@ -1311,6 +1332,28 @@ class Manager
|
|
1311
1332
|
rc
|
1312
1333
|
end
|
1313
1334
|
|
1335
|
+
def getText(_locator)
|
1336
|
+
@logger.debug __FILE__ + (__LINE__).to_s + " getText?(#{_locator})"
|
1337
|
+
rc = false
|
1338
|
+
|
1339
|
+
begin
|
1340
|
+
obj = findLocator(_locator)
|
1341
|
+
|
1342
|
+
@logger.debug __FILE__ + (__LINE__).to_s + " | obj : #{obj}"
|
1343
|
+
|
1344
|
+
if !obj.nil?
|
1345
|
+
@logger.debug __FILE__ + (__LINE__).to_s + " | obj.text: #{obj.text}"
|
1346
|
+
rc = obj.text
|
1347
|
+
end
|
1348
|
+
|
1349
|
+
rescue => ex
|
1350
|
+
@logger.warn __FILE__ + (__LINE__).to_s + " #{ex.class}"
|
1351
|
+
@logger.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
1352
|
+
end
|
1353
|
+
|
1354
|
+
@logger.debug __FILE__ + (__LINE__).to_s + " [return]: isText?(#{_locator}) : #{rc}"
|
1355
|
+
rc
|
1356
|
+
end
|
1314
1357
|
|
1315
1358
|
def isText?(_locator, regex=nil)
|
1316
1359
|
@logger.debug __FILE__ + (__LINE__).to_s + " isText?(#{_locator}, #{regex})"
|
@@ -1362,32 +1405,38 @@ class Manager
|
|
1362
1405
|
rc
|
1363
1406
|
end
|
1364
1407
|
|
1365
|
-
def pressKey(k, n = 1)
|
1408
|
+
def pressKey(k, n = 1, _delay = 0.25)
|
1366
1409
|
|
1367
1410
|
rc = 0
|
1368
1411
|
begin
|
1369
1412
|
n.times {
|
1370
|
-
if k.match(/^\s*tab
|
1413
|
+
if k.match(/^\s*(tab|__tab__)\s*$/i)
|
1371
1414
|
activeElt = @drv.switch_to.active_element
|
1372
|
-
activeElt.send_keys(:tab)
|
1415
|
+
n.times { activeElt.send_keys(:tab); rc+=1; }
|
1416
|
+
break;
|
1373
1417
|
elsif k.match(/^\s*clear\s*$/)
|
1374
1418
|
activeElt = @drv.switch_to.active_element
|
1375
1419
|
activeElt.clear
|
1376
|
-
elsif k.match(
|
1420
|
+
elsif k.match(/^\s*^enter\s*$/i)
|
1377
1421
|
activeElt = @drv.switch_to.active_element
|
1378
1422
|
activeElt.send_keys(:enter)
|
1379
|
-
elsif k.match(
|
1423
|
+
elsif k.match(/^\s*(down|arrow_down|down_arrow|__down__)\s*/)
|
1424
|
+
n.times { activeElt = @drv.switch_to.active_element; activeElt.send_keys(:arrow_down); sleep _delay; rc+=1 }
|
1425
|
+
return rc;
|
1426
|
+
elsif k.match(/^\s*(space|__space__)\s*$/i)
|
1380
1427
|
activeElt = @drv.switch_to.active_element
|
1381
|
-
activeElt.send_keys(:
|
1382
|
-
|
1383
|
-
|
1384
|
-
activeElt.send_keys(:arrow_up)
|
1385
|
-
|
1428
|
+
n.times { activeElt.send_keys(:space); sleep _delay; rc+=1 }
|
1429
|
+
break
|
1430
|
+
elsif k.match(/^\s*(up|arrow_up|up_arrow|__up__)\s*$/)
|
1431
|
+
n.times { activeElt = @drv.switch_to.active_element; activeElt.send_keys(:arrow_up); sleep _delay; rc+=1 }
|
1432
|
+
return rc;
|
1433
|
+
elsif k.match(/^\s*escape\s*$/i)
|
1386
1434
|
activeElt = @drv.switch_to.active_element
|
1387
1435
|
activeElt.send_keys(:escape)
|
1388
|
-
elsif k.match(
|
1389
|
-
@drv.action.send_keys(:page_down).perform
|
1390
|
-
|
1436
|
+
elsif k.match(/^\s*page_down\s*/i)
|
1437
|
+
n.times { activeElt = @drv.switch_to.active_element; @drv.action.send_keys(:page_down).perform; sleep _delay; rc+=1 }
|
1438
|
+
break
|
1439
|
+
elsif k.match(/^\s*__SHIFT_TAB__\s*$/i)
|
1391
1440
|
@drv.action.key_down(:shift).send_keys(:tab).perform
|
1392
1441
|
@drv.action.key_up(:shift).perform
|
1393
1442
|
else
|
data/lib/browza/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.3.5
|
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-
|
11
|
+
date: 2017-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- browza.gemspec
|
122
122
|
- examples/ex1.rb
|
123
123
|
- examples/ex2.rb
|
124
|
+
- examples/fox.proxy.rb
|
124
125
|
- examples/parms.rb
|
125
126
|
- lib/browza.rb
|
126
127
|
- lib/browza/base/browza_mgr.rb
|