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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f711eb863313bb4ebb804b8a8d531304b76d9faea6afb4ad347fb418acd267b3
4
- data.tar.gz: f5f7016f636a77f68519aa7db4847a3989b3f44e9b9c59326e3acbd0976b06e9
3
+ metadata.gz: 343ac6bd7d2660fa5503615f384933df9dae903a69d242791edf03ba75d93fea
4
+ data.tar.gz: aa8d6d88db9dd61ae94fb4bc60f1b30c60923239209e1732cc7613c14e97accd
5
5
  SHA512:
6
- metadata.gz: eb714bc6d80b581185835d26d96d7ae3b1de0b673d0b9ef071f26a74dd4a15066bfaf6e7269b33e005ad4fe0197b90a8345b4466cc03d3dd807d648ed4c14df8
7
- data.tar.gz: b4744b3813485365e683a4fa0a1d131ee0fb2032319b2e01dc466d413060bac1623ef0189c90db80855fe63cfd6146e8c133d2b6dda3bf8ff30bb8eede33a736
6
+ metadata.gz: 20439f0110dac3a95d059f47feedc6d2a26d15b7bf3830f5d633307100aa0e6d0e0ade531dd46692dcfd02ffdd69d8f8e241818310a1bbf1f6fee520ee5143e6
7
+ data.tar.gz: 3002d0d9c1c76be747c03d5e6f162fd97e7c51e1b8f1bc0ad97c5224a812cd51a821a4ac314f8b7be5219c8dcce0948b44b46b6cd5ad0e6f3881399e8e295b6b
data/bin/browse CHANGED
@@ -16,7 +16,8 @@ client = Browsed::Client.new(
16
16
  device: :desktop,
17
17
  environment: :development,
18
18
  user_agent: :randomize,
19
- resolution: [1920,1080]
19
+ resolution: [1920,1080],
20
+ options: {open_timeout: 30, read_timeout: 30}
20
21
  )
21
22
 
22
23
  client.resize! # Set resolution
@@ -2,11 +2,12 @@ module Browsed
2
2
  module Chrome
3
3
 
4
4
  private
5
- def register_chrome_driver(options: {}, timeout: 60, debug: false)
6
- headless = options.fetch(:headless, false)
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
- Capybara::Selenium::Driver.new(app, browser: :chrome, options: options, desired_capabilities: capabilities)
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
 
@@ -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, 30) #seconds
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.merge(headless: true))
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, headless: true))
124
+ register_chrome_driver(options: options.merge(resolution: self.resolution))
125
125
  end
126
126
  end
127
127
 
@@ -2,9 +2,10 @@ module Browsed
2
2
  module Firefox
3
3
 
4
4
  private
5
- def register_firefox_driver(options: {}, timeout: 60, debug: false)
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
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
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
@@ -1,3 +1,3 @@
1
1
  module Browsed
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browsed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian