aranha-selenium 0.1.3 → 0.2.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21d5ec38a1006e6df4ea9f098fb351fb61e8d174e306f6ba858a9efacc53f4c0
|
4
|
+
data.tar.gz: 436207b23653cd35ce02368a27bccb04544242d1d3d77e7e92ef289f1dfb1e63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99b2874c772bda29cb94d0da4622af3ed5ee7536fe5c089aa32d6a913b4fc5e959bb4008b868df6e0f1c15aba91e32b0e2ddba2d4db66c1ac800ca142ede58d2
|
7
|
+
data.tar.gz: 17f830d15dd7174de9a118a5a1eee5204bb57ac33f40fe7741eabafe6d4973759854d61cfef35c358dd63ca49bdd751db6931644c2748f8703c4bbc2cc96b981
|
@@ -14,14 +14,19 @@ module Aranha
|
|
14
14
|
|
15
15
|
def chrome_options
|
16
16
|
r = ::Selenium::WebDriver::Chrome::Options.new
|
17
|
-
r.add_argument(
|
18
|
-
r.add_argument('--headless') if headless?
|
19
|
-
r.add_argument('--disable-popup-blocking')
|
20
|
-
r.add_argument('--disable-translate')
|
21
|
-
r.add_argument("user-agent=#{user_agent}") if user_agent.present?
|
17
|
+
chrome_arguments.each { |arg| r.add_argument(arg) }
|
22
18
|
r.add_preference(:download, prompt_for_download: false, default_directory: downloads_dir)
|
23
19
|
r
|
24
20
|
end
|
21
|
+
|
22
|
+
def chrome_arguments
|
23
|
+
r = %w[--disable-popup-blocking --disable-translate]
|
24
|
+
r << '--ignore-certificate-errors' if accept_insecure_certs?
|
25
|
+
r << '--headless' if headless?
|
26
|
+
r << "--user-agent=#{user_agent}" if user_agent.present?
|
27
|
+
r << "--user-data-dir=#{profile_dir}" if profile_dir.present?
|
28
|
+
r
|
29
|
+
end
|
25
30
|
end
|
26
31
|
end
|
27
32
|
end
|
@@ -9,10 +9,7 @@ module Aranha
|
|
9
9
|
def build
|
10
10
|
::Selenium::WebDriver.for(
|
11
11
|
:firefox,
|
12
|
-
options:
|
13
|
-
profile: build_profile,
|
14
|
-
args: build_args
|
15
|
-
),
|
12
|
+
options: build_options,
|
16
13
|
desired_capabilities: build_capabilities
|
17
14
|
)
|
18
15
|
end
|
@@ -21,7 +18,7 @@ module Aranha
|
|
21
18
|
|
22
19
|
def build_args
|
23
20
|
r = []
|
24
|
-
r << '
|
21
|
+
r << '--headless' if headless?
|
25
22
|
r
|
26
23
|
end
|
27
24
|
|
@@ -33,16 +30,33 @@ module Aranha
|
|
33
30
|
end
|
34
31
|
end
|
35
32
|
|
36
|
-
def
|
37
|
-
r = ::Selenium::WebDriver::Firefox::
|
38
|
-
|
39
|
-
r
|
40
|
-
r
|
41
|
-
|
33
|
+
def build_options
|
34
|
+
r = ::Selenium::WebDriver::Firefox::Options.new(args: build_args,
|
35
|
+
prefs: build_preferences)
|
36
|
+
build_profile.if_present { |v| r.profile = v }
|
37
|
+
r
|
38
|
+
end
|
39
|
+
|
40
|
+
def build_preferences
|
41
|
+
r = {
|
42
|
+
'browser.download.dir' => downloads_dir,
|
43
|
+
'browser.download.folderList' => 2,
|
44
|
+
'browser.helperApps.neverAsk.saveToDisk' => auto_download_mime_types.join(';'),
|
45
|
+
'pdfjs.disabled' => true
|
46
|
+
}
|
42
47
|
r['general.useragent.override'] = user_agent if user_agent.present?
|
43
48
|
r
|
44
49
|
end
|
45
50
|
|
51
|
+
def build_profile
|
52
|
+
if profile_name.present?
|
53
|
+
::Selenium::WebDriver::Firefox::Profile.from_name(v)
|
54
|
+
elsif profile_dir.present?
|
55
|
+
::FileUtils.mkdir_p(profile_dir)
|
56
|
+
::Selenium::WebDriver::Firefox::Profile.new(profile_dir)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
46
60
|
def auto_download_mime_types
|
47
61
|
::File.read(
|
48
62
|
::File.join(__dir__, 'firefox_auto_download_mime_types')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aranha-selenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -97,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
|
101
|
-
rubygems_version: 2.7.7
|
100
|
+
rubygems_version: 3.0.9
|
102
101
|
signing_key:
|
103
102
|
specification_version: 4
|
104
103
|
summary: Selenium' utilities for Ruby.
|