browsed 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/browse +2 -1
- data/lib/browsed/chrome.rb +7 -5
- data/lib/browsed/client.rb +3 -3
- data/lib/browsed/firefox.rb +6 -4
- data/lib/browsed/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 343ac6bd7d2660fa5503615f384933df9dae903a69d242791edf03ba75d93fea
|
4
|
+
data.tar.gz: aa8d6d88db9dd61ae94fb4bc60f1b30c60923239209e1732cc7613c14e97accd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20439f0110dac3a95d059f47feedc6d2a26d15b7bf3830f5d633307100aa0e6d0e0ade531dd46692dcfd02ffdd69d8f8e241818310a1bbf1f6fee520ee5143e6
|
7
|
+
data.tar.gz: 3002d0d9c1c76be747c03d5e6f162fd97e7c51e1b8f1bc0ad97c5224a812cd51a821a4ac314f8b7be5219c8dcce0948b44b46b6cd5ad0e6f3881399e8e295b6b
|
data/bin/browse
CHANGED
data/lib/browsed/chrome.rb
CHANGED
@@ -2,11 +2,12 @@ module Browsed
|
|
2
2
|
module Chrome
|
3
3
|
|
4
4
|
private
|
5
|
-
def register_chrome_driver(options: {}
|
6
|
-
|
5
|
+
def register_chrome_driver(options: {})
|
6
|
+
open_timeout = options.fetch(:open_timeout, 60)
|
7
|
+
read_timeout = options.fetch(:read_timeout, 60)
|
7
8
|
resolution = options.fetch(:resolution, [1366,768])
|
8
|
-
profile = Selenium::WebDriver::Chrome::Profile.new
|
9
9
|
|
10
|
+
profile = Selenium::WebDriver::Chrome::Profile.new
|
10
11
|
profile["user-agent"] = self.user_agent unless self.user_agent.to_s.empty?
|
11
12
|
|
12
13
|
proxy_options = manage_chrome_proxy
|
@@ -16,13 +17,14 @@ module Browsed
|
|
16
17
|
|
17
18
|
args = %w(disable-popup-blocking)
|
18
19
|
args = args | %W(window-size=#{resolution.first},#{resolution.last}) if resolution && resolution.any? && resolution.size.eql?(2)
|
19
|
-
args = args | %w(headless disable-gpu) if headless
|
20
|
+
args = args | %w(headless disable-gpu) if headless?
|
20
21
|
args = args | %W(load-extension=#{proxy_plugin_path}) unless proxy_plugin_path.to_s.empty?
|
21
22
|
|
22
23
|
options = Selenium::WebDriver::Chrome::Options.new(profile: profile, args: args)
|
23
24
|
|
24
25
|
Capybara.register_driver self.driver do |app|
|
25
|
-
|
26
|
+
client = Selenium::WebDriver::Remote::Http::Default.new(open_timeout: open_timeout, read_timeout: read_timeout)
|
27
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, http_client: client, options: options, desired_capabilities: capabilities)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
data/lib/browsed/client.rb
CHANGED
@@ -53,7 +53,7 @@ module Browsed
|
|
53
53
|
Capybara.default_driver = self.driver
|
54
54
|
Capybara.javascript_driver = self.driver
|
55
55
|
|
56
|
-
Capybara.default_max_wait_time = options.fetch(:wait_time,
|
56
|
+
Capybara.default_max_wait_time = options.fetch(:wait_time, 5) #seconds
|
57
57
|
|
58
58
|
self.session = Capybara::Session.new(self.driver)
|
59
59
|
else
|
@@ -114,14 +114,14 @@ module Browsed
|
|
114
114
|
register_firefox_driver(options: options)
|
115
115
|
elsif firefox_headless_browser?
|
116
116
|
self.headless = true
|
117
|
-
register_firefox_driver(options: options
|
117
|
+
register_firefox_driver(options: options)
|
118
118
|
elsif chrome_browser?
|
119
119
|
self.driver = :selenium_chrome
|
120
120
|
register_chrome_driver(options: options.merge(resolution: self.resolution))
|
121
121
|
elsif chrome_headless_browser?
|
122
122
|
self.headless = true
|
123
123
|
self.driver = :selenium_chrome_headless
|
124
|
-
register_chrome_driver(options: options.merge(resolution: self.resolution
|
124
|
+
register_chrome_driver(options: options.merge(resolution: self.resolution))
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
data/lib/browsed/firefox.rb
CHANGED
@@ -2,9 +2,10 @@ module Browsed
|
|
2
2
|
module Firefox
|
3
3
|
|
4
4
|
private
|
5
|
-
def register_firefox_driver(options: {}
|
5
|
+
def register_firefox_driver(options: {})
|
6
|
+
open_timeout = options.fetch(:open_timeout, 60)
|
7
|
+
read_timeout = options.fetch(:read_timeout, 60)
|
6
8
|
browser_id = options.fetch(:browser_id, nil)
|
7
|
-
headless = options.fetch(:headless, false)
|
8
9
|
download_path = options.fetch(:download_path, self.configuration.download_path)
|
9
10
|
private_browsing = options.fetch(:private_browsing, false)
|
10
11
|
|
@@ -31,10 +32,11 @@ module Browsed
|
|
31
32
|
profile = firefox_proxy_options(profile)
|
32
33
|
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
|
33
34
|
options.args << "--browser_id=#{id}" unless browser_id.to_s.empty?
|
34
|
-
options.args << "--headless" if headless
|
35
|
+
options.args << "--headless" if headless?
|
35
36
|
|
36
37
|
Capybara.register_driver self.driver do |app|
|
37
|
-
|
38
|
+
client = Selenium::WebDriver::Remote::Http::Default.new(open_timeout: open_timeout, read_timeout: read_timeout)
|
39
|
+
Capybara::Selenium::Driver.new(app, browser: :firefox, http_client: client, options: options)
|
38
40
|
end
|
39
41
|
|
40
42
|
return id
|
data/lib/browsed/version.rb
CHANGED