browsed 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/browse +3 -1
- data/lib/browsed/client.rb +9 -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: f1dcc1ed224b661035c70a3ecd01bc9865223ee504bf698783e049f2cac76157
|
4
|
+
data.tar.gz: 80c2a3f1624b49b21a2a8185bc940f87cd56798c5eb2c8bd9e258dbc64eea1a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d2edf3dec1d5b19ff8f3e94c96e400360da0775e6549f23715b4b0756890f377e167f1cbc685e8eaef0ccbeb967151e08037c02f7ace75a99081460cb36d5de
|
7
|
+
data.tar.gz: d5c9be8ade68d874af45dbf08a7507601dc7562a4524655c4d1225ef3f63678165796bb28770d649da603048461c0b7f1fa95c26ed29d617dea621a5a2dc1cb0
|
data/Gemfile.lock
CHANGED
data/bin/browse
CHANGED
@@ -10,7 +10,9 @@ browser = :firefox
|
|
10
10
|
url = "https://whatismyipaddress.com"
|
11
11
|
path = File.expand_path("../../files/#{Time.now.to_i}.png", __FILE__)
|
12
12
|
|
13
|
-
client = Browsed::Client.new(driver: driver, browser: browser, device: :desktop, environment: :development)
|
13
|
+
client = Browsed::Client.new(driver: driver, browser: browser, device: :desktop, environment: :development, resolution: [1366,768])
|
14
|
+
|
15
|
+
client.resize! # Set resolution
|
14
16
|
|
15
17
|
client.session.visit(url)
|
16
18
|
|
data/lib/browsed/client.rb
CHANGED
@@ -53,10 +53,6 @@ module Browsed
|
|
53
53
|
Capybara.default_max_wait_time = driver_options.fetch(:wait_time, 30) #seconds
|
54
54
|
|
55
55
|
self.session = Capybara::Session.new(self.driver)
|
56
|
-
|
57
|
-
if self.resolution&.any? && !self.driver.eql?(:poltergeist) # Resolution for Poltergeist is set in the driver
|
58
|
-
self.session.current_window.resize_to(self.resolution.first, self.resolution.last) # [width, height]
|
59
|
-
end
|
60
56
|
else
|
61
57
|
raise Browsed::TooManyProcessesError, "Too many PhantomJS processes running, reached maximum allowed number of #{self.maximum_processes}"
|
62
58
|
end
|
@@ -70,6 +66,15 @@ module Browsed
|
|
70
66
|
Launchy.open path if development?
|
71
67
|
end
|
72
68
|
|
69
|
+
# Resize the window separately and not based on initialization
|
70
|
+
def resize!(res = nil)
|
71
|
+
res ||= self.resolution
|
72
|
+
|
73
|
+
if res && res.size.eql?(2) && !self.driver.eql?(:poltergeist) # Resolution for Poltergeist is set in the driver
|
74
|
+
self.session.current_window.resize_to(res.first, res.last) # [width, height]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
73
78
|
def reset_session!
|
74
79
|
self.session.reset_session!
|
75
80
|
end
|
data/lib/browsed/version.rb
CHANGED