rudra 1.1.3 → 1.1.4
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/rudra.rb +16 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fea1605ee31709cb1dcb4c868ec5df73c650b459dcafea5c78504b3e90abe4f6
|
4
|
+
data.tar.gz: 0e3ea81a32db0e5f85e3b90af70abac74c54842dc8556f57256fc1f39b1e3f0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3634c208291be7f59897a94b85c1cec4b2666db41551b5aad64b3761590819524c7a43ea501dbf031285284bb5df6ab2f12d0354d5428707bd17f76e3da6d4c7
|
7
|
+
data.tar.gz: 1359e36111a9f186fbc53d8d7b7e183f0c6f40465a895e28d28a6ab54a0e680b2235b2a8f2dfe2b7fa358b788a85e74bb68c5259d2c7fbeca978b174dfe85d6c
|
data/lib/rudra.rb
CHANGED
@@ -19,8 +19,8 @@ require 'stringio'
|
|
19
19
|
# @attr_reader [Integer] timeout The driver timeout
|
20
20
|
# @attr_reader [Boolean] verbose Turn on/off Verbose mode
|
21
21
|
# @attr_reader [Boolean] silent Turn off Turn on/off descriptions
|
22
|
-
# @attr_reader [String]
|
23
|
-
# @attr_reader [String]
|
22
|
+
# @attr_reader [String] auth_username username for Basic Access Authentication Extension (Chrome only)
|
23
|
+
# @attr_reader [String] auth_password password for Basic Access Authentication Extension (Chrome only)
|
24
24
|
class Rudra
|
25
25
|
# Supported Browsers
|
26
26
|
BROWSERS = %i[chrome firefox ie safari].freeze
|
@@ -36,13 +36,13 @@ class Rudra
|
|
36
36
|
browser driver install_dir locale
|
37
37
|
headless window_size screen_dir
|
38
38
|
log_prefix timeout verbose silent
|
39
|
-
|
39
|
+
auth_username auth_password
|
40
40
|
].freeze
|
41
41
|
|
42
42
|
attr_reader :browser, :driver, :install_dir, :locale,
|
43
43
|
:headless, :window_size, :screen_dir,
|
44
44
|
:log_prefix, :timeout, :verbose, :silent,
|
45
|
-
:
|
45
|
+
:auth_username, :auth_password
|
46
46
|
|
47
47
|
# Initialize an instance of Rudra
|
48
48
|
# @param [Hash] options the options to initialize Rudra
|
@@ -58,8 +58,8 @@ class Rudra
|
|
58
58
|
# @option options [Integer] :timeout (30) implicit_wait timeout
|
59
59
|
# @option options [Boolean] :verbose (false) Turn on/off verbose mode
|
60
60
|
# @option options [Boolean] :silent (false) Turn on/off descriptions
|
61
|
-
# @option options [String] :
|
62
|
-
# @option options [String] :
|
61
|
+
# @option options [String] :auth_username ('') username for Basic Access Authentication extension
|
62
|
+
# @option options [String] :auth_password ('') password for Basic Access Authentication extension
|
63
63
|
def initialize(options = {})
|
64
64
|
self.browser = options.fetch(:browser, :chrome)
|
65
65
|
self.install_dir = options.fetch(:install_dir, './webdrivers/')
|
@@ -70,8 +70,8 @@ class Rudra
|
|
70
70
|
self.log_prefix = options.fetch(:log_prefix, ' - ')
|
71
71
|
self.verbose = options.fetch(:verbose, false)
|
72
72
|
self.silent = options.fetch(:silent, false)
|
73
|
-
self.
|
74
|
-
self.
|
73
|
+
self.auth_username = options.fetch(:auth_username, '')
|
74
|
+
self.auth_password = options.fetch(:auth_password, '')
|
75
75
|
self.main_label = caller_locations(2, 1).first.label
|
76
76
|
|
77
77
|
initialize_driver
|
@@ -384,10 +384,10 @@ class Rudra
|
|
384
384
|
wait_for { find_element(locator).enabled? }
|
385
385
|
end
|
386
386
|
|
387
|
-
#
|
387
|
+
# Switch to a frame and wait until the element, identified by locator, is found
|
388
388
|
# @param [String] frame_id the frame id
|
389
389
|
# @param [String] locator the locator to identify the element
|
390
|
-
def
|
390
|
+
def switch_to_frame_and_wait_for_element_found(frame_id, locator)
|
391
391
|
switch_to_frame frame_id
|
392
392
|
|
393
393
|
how, what = parse_locator(locator)
|
@@ -1213,7 +1213,7 @@ class Rudra
|
|
1213
1213
|
private
|
1214
1214
|
|
1215
1215
|
attr_accessor :main_label
|
1216
|
-
attr_writer :silent, :window_size, :
|
1216
|
+
attr_writer :silent, :window_size, :auth_username, :auth_password
|
1217
1217
|
|
1218
1218
|
def browser=(brw)
|
1219
1219
|
unless BROWSERS.include?(brw)
|
@@ -1284,8 +1284,8 @@ class Rudra
|
|
1284
1284
|
options.add_argument('--headless')
|
1285
1285
|
options.add_argument("--window-size=#{window_size}")
|
1286
1286
|
end
|
1287
|
-
if
|
1288
|
-
encoded = chrome_basic_auth_extension(
|
1287
|
+
if auth_username && auth_password
|
1288
|
+
encoded = chrome_basic_auth_extension(auth_username, auth_password)
|
1289
1289
|
options.add_encoded_extension(encoded)
|
1290
1290
|
end
|
1291
1291
|
options.add_option(
|
@@ -1364,7 +1364,7 @@ class Rudra
|
|
1364
1364
|
def chrome_basic_auth_extension(username, password)
|
1365
1365
|
manifest = {
|
1366
1366
|
"manifest_version": 2,
|
1367
|
-
"name": 'Rudra Basic
|
1367
|
+
"name": 'Rudra Basic Access Authentication Extension',
|
1368
1368
|
"version": '1.0.0',
|
1369
1369
|
"permissions": ['*://*/*', 'webRequest', 'webRequestBlocking'],
|
1370
1370
|
"background": {
|
@@ -1372,7 +1372,7 @@ class Rudra
|
|
1372
1372
|
}
|
1373
1373
|
}
|
1374
1374
|
|
1375
|
-
background = <<~
|
1375
|
+
background = <<~JAVASCRIPT
|
1376
1376
|
var username = '#{username}';
|
1377
1377
|
var password = '#{password}';
|
1378
1378
|
|
@@ -1390,7 +1390,7 @@ class Rudra
|
|
1390
1390
|
{ urls: ['<all_urls>'] },
|
1391
1391
|
['blocking']
|
1392
1392
|
);
|
1393
|
-
|
1393
|
+
JAVASCRIPT
|
1394
1394
|
|
1395
1395
|
stringio = Zip::OutputStream.write_buffer do |zos|
|
1396
1396
|
zos.put_next_entry('manifest.json')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|