browsed 0.1.0 → 0.1.1

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: 273de99ce82d529db724b003f381012c5b1f92334d51cf313c8f6eb7cdbc924a
4
- data.tar.gz: 57b78a4285b0345005e5e1b1fd62c5d971a8a4f4158a54b4e9ff54cfc05c98e7
3
+ metadata.gz: 5e4e1bad4aea31f419ea850bb4ccec0b8f8f2691edc62a8ba19eda0fb19b3110
4
+ data.tar.gz: 7d4c642d6c6cccc3e334dddb9e77604d0ad16987e13bfe1ae26c381dcdce7b49
5
5
  SHA512:
6
- metadata.gz: 7e410f72cb0b1ddede87f09f2693378cb8e7821a2519e15f724fd4fafe7ac24486e1c7db6a3da1c1f5bd482e6c5423a4b857654e6ce6d6384262e2e571e1f170
7
- data.tar.gz: 542852786da4017490e028df8e2ff1eaad8021c92ef17efec8900684b0200343b8315d212db78e46b84561a5f9c37cd07d175c33345a66876193239432d0b218
6
+ metadata.gz: 0aba65bc0ca76bbba834a7947dbd5c1100c168d9bb969bbc343b89280af7150829c6e2102648fc1a18b9e589fad78f91a639b9fc6789f9006fbf56e6d58bcb23
7
+ data.tar.gz: 6f6876c72c3a38723b5cd707ae087d4409985c31196462a3e7b7bc378d785e0a4723ffaf5d00d4f003a2189d597ed569aa1dc285f64956e57804d68abb8c86e1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- browsed (0.1.0)
4
+ browsed (0.1.1)
5
5
  agents
6
6
  capybara (~> 3.4, >= 3.4.1)
7
7
  poltergeist (~> 1.18, >= 1.18.1)
@@ -45,19 +45,7 @@ module Browsed
45
45
 
46
46
  def setup_capybara(driver_options: {}, retries: 3)
47
47
  if can_start_new_process?
48
- if poltergeist?
49
- register_poltergeist_driver(driver_options: driver_options)
50
- elsif selenium?
51
- if firefox_browser?
52
- register_firefox_driver(driver_options: driver_options)
53
- elsif chrome_browser?
54
- self.driver = :selenium_chrome
55
- register_chrome_driver(driver_options: driver_options)
56
- end
57
- end
58
-
59
- puts "Self.driver: #{self.driver}"
60
- puts "Self.browser: #{self.browser}"
48
+ register_driver!(driver_options)
61
49
 
62
50
  Capybara.default_driver = self.driver
63
51
  Capybara.javascript_driver = self.driver
@@ -78,7 +66,30 @@ module Browsed
78
66
  Launchy.open path if development?
79
67
  end
80
68
 
69
+ def reset_session!
70
+ self.session.reset_session!
71
+ end
72
+
73
+ def terminate_session!
74
+ self.session.reset_session!
75
+ self.session.driver.quit
76
+ self.session = nil
77
+ end
78
+
81
79
  private
80
+ def register_driver!(driver_options = {})
81
+ if poltergeist?
82
+ register_poltergeist_driver(driver_options: driver_options)
83
+ elsif selenium?
84
+ if firefox_browser?
85
+ register_firefox_driver(driver_options: driver_options)
86
+ elsif chrome_browser?
87
+ self.driver = :selenium_chrome
88
+ register_chrome_driver(driver_options: driver_options)
89
+ end
90
+ end
91
+ end
92
+
82
93
  def poltergeist?
83
94
  self.driver.to_sym.eql?(:poltergeist)
84
95
  end
@@ -103,11 +114,6 @@ module Browsed
103
114
  self.environment.eql?(env)
104
115
  end
105
116
 
106
- def terminate_session!(retries: 3)
107
- self.session.driver.quit
108
- self.session = nil
109
- end
110
-
111
117
  # User Agents
112
118
  def set_user_agent(user_agent)
113
119
  if !user_agent.to_s.empty?
@@ -4,12 +4,14 @@ module Browsed
4
4
  private
5
5
  def register_firefox_driver(driver_options: {}, timeout: 60, debug: false)
6
6
  download_path = driver_options.fetch(:download_path, self.configuration.download_path)
7
- enable_firebug = driver_options.fetch(:enable_firebug, false)
7
+ private_browsing = driver_options.fetch(:private_browsing, false)
8
8
 
9
9
  profile = Selenium::WebDriver::Firefox::Profile.new
10
10
 
11
- profile.enable_firebug if enable_firebug
12
-
11
+ if private_browsing
12
+ profile["browser.privatebrowsing.autostart"] = true
13
+ end
14
+
13
15
  unless download_path.to_s.empty?
14
16
  profile["browser.download.useDownloadDir"] = true
15
17
  profile["browser.download.dir"] = download_directory
@@ -1,3 +1,3 @@
1
1
  module Browsed
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian