watir-screenshot-stitch 0.6.8 → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +5 -0
- data/README.md +15 -3
- data/lib/watir-screenshot-stitch.rb +16 -5
- data/lib/watir-screenshot-stitch/version.rb +1 -1
- data/watir-screenshot-stitch.gemspec +3 -2
- metadata +19 -4
- data/Gemfile.lock +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: '0985890117543c5ed7884e494c015439abe061ea'
|
4
|
+
data.tar.gz: 37a9faf7f9e21dee30810044322d63ccc9193061
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63717c4834cdb6016b1000440b0fd3af5c1663c59d1eed651b205120e306223819b14a6de38471fabc8a6c9b80f5038458aa0db09c50cd45a58bc1042dbabe76
|
7
|
+
data.tar.gz: 7101edc1f9aebdfd17bf9ecb3d2d233d091bd53f8b5d1b394e97da9d210aa1b715b8dd75fa4ce7b78a615d78416590f36543b729a03b553217acc01367958fa1
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -20,10 +20,15 @@ watir-screenshot-stitch relies on [MiniMagick](https://github.com/minimagick/min
|
|
20
20
|
(and thus ImageMagick). You might need to review that gem's requirements and
|
21
21
|
installation before proceeding.
|
22
22
|
|
23
|
-
###
|
23
|
+
### Browser Support
|
24
24
|
|
25
|
-
watir-screenshot-stitch is optimized for and tested on
|
26
|
-
|
25
|
+
watir-screenshot-stitch is optimized for and tested on following browsers:
|
26
|
+
* Chrome 65+
|
27
|
+
* Firefox 58+
|
28
|
+
* Safari 11.1
|
29
|
+
* IE 11/10/9/8
|
30
|
+
|
31
|
+
Your Watir / Selenium-Webdriver / webdriver / Browser stack must be correctly
|
27
32
|
configured. If you can find a good guide for installing and maintaining all
|
28
33
|
parts of this stack, you're a better Googler than me.
|
29
34
|
|
@@ -75,6 +80,13 @@ b.screenshot.base64_canvas(b)
|
|
75
80
|
|
76
81
|
will return a base64 encoded image blob of the given site.
|
77
82
|
|
83
|
+
In can be saved as a PNG by doing:
|
84
|
+
```ruby
|
85
|
+
png = b.screenshot.base64_canvas(b)
|
86
|
+
path = "/my/path/image.png"
|
87
|
+
File.open(path, 'wb') { |f| f.write(Base64.decode64(png)) }
|
88
|
+
```
|
89
|
+
|
78
90
|
### Doubling resolution calculations, including macOS Retina
|
79
91
|
|
80
92
|
watir-screenshot-stitch uses CSS selectors to determine whether a
|
@@ -28,6 +28,7 @@ module Watir
|
|
28
28
|
#
|
29
29
|
|
30
30
|
def save_stitch(path, browser = @browser, opts = {})
|
31
|
+
return browser.screenshot.save(path) if base64_capable?
|
31
32
|
@options = opts
|
32
33
|
@path = path
|
33
34
|
deprecate_browser(browser, (__LINE__-3))
|
@@ -57,6 +58,7 @@ module Watir
|
|
57
58
|
#
|
58
59
|
|
59
60
|
def base64_canvas(browser = @browser)
|
61
|
+
return self.base64 if base64_capable?
|
60
62
|
deprecate_browser(browser, (__LINE__-1))
|
61
63
|
output = nil
|
62
64
|
|
@@ -71,7 +73,7 @@ module Watir
|
|
71
73
|
|
72
74
|
raise "Could not generate screenshot blob within #{MAXIMUM_SCREENSHOT_GENERATION_WAIT_TIME} seconds" unless output
|
73
75
|
|
74
|
-
|
76
|
+
output.sub!(/^data\:image\/png\;base64,/, '')
|
75
77
|
end
|
76
78
|
|
77
79
|
private
|
@@ -81,6 +83,11 @@ module Watir
|
|
81
83
|
@browser = browser
|
82
84
|
end
|
83
85
|
|
86
|
+
# in IE & Safari a regular screenshot is a full page screenshot only
|
87
|
+
def base64_capable?
|
88
|
+
[:internet_explorer, :safari].include? @browser&.name
|
89
|
+
end
|
90
|
+
|
84
91
|
def one_shot?
|
85
92
|
calculate_dimensions unless @loops && @remainder
|
86
93
|
( (@loops == 1) && (@remainder == 0) )
|
@@ -99,7 +106,7 @@ module Watir
|
|
99
106
|
end # https://github.com/mozilla/geckodriver/issues/1129
|
100
107
|
|
101
108
|
def h2c_activator
|
102
|
-
|
109
|
+
case @browser.driver.browser
|
103
110
|
when :firefox
|
104
111
|
%<
|
105
112
|
function genScreenshot () {
|
@@ -125,7 +132,7 @@ module Watir
|
|
125
132
|
end
|
126
133
|
|
127
134
|
def html2canvas_payload
|
128
|
-
|
135
|
+
case @browser.driver.browser
|
129
136
|
when :firefox
|
130
137
|
path = File.join(WatirScreenshotStitch::Utilities.directory, "vendor/html2canvas-0.4.1.js")
|
131
138
|
File.read(path)
|
@@ -204,8 +211,12 @@ module Watir
|
|
204
211
|
end
|
205
212
|
|
206
213
|
def retina?
|
207
|
-
payload = %{var mq = window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3),
|
208
|
-
|
214
|
+
payload = %{ var mq = window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), \
|
215
|
+
only screen and (-o-min-device-pixel-ratio: 2.6/2), \
|
216
|
+
only screen and (-webkit-min-device-pixel-ratio: 1.3), \
|
217
|
+
only screen and (min-device-pixel-ratio: 1.3), \
|
218
|
+
only screen and (min-resolution: 1.3dppx)");
|
219
|
+
return (mq && mq.matches || (window.devicePixelRatio > 1)); }
|
209
220
|
@browser.execute_script payload
|
210
221
|
end
|
211
222
|
end
|
@@ -6,8 +6,8 @@ require "watir-screenshot-stitch/version"
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "watir-screenshot-stitch"
|
8
8
|
spec.version = WatirScreenshotStitch::VERSION
|
9
|
-
spec.authors = ["Sam Nissen"]
|
10
|
-
spec.email = ["scnissen@gmail.com"]
|
9
|
+
spec.authors = ["Sam Nissen", "Sandeep Singh"]
|
10
|
+
spec.email = ["scnissen@gmail.com", "sandeepnagra@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Extends Watir to take stitched-together screenshots of full web pages.}
|
13
13
|
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
36
|
spec.add_development_dependency "chunky_png", "~> 1.3"
|
37
37
|
|
38
|
+
spec.add_dependency "rubyzip", "~> 1.2.2"
|
38
39
|
spec.add_dependency "watir", "~> 6.4"
|
39
40
|
spec.add_dependency "mini_magick", "~> 4.0"
|
40
41
|
spec.add_dependency "os", "~> 1.0"
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-screenshot-stitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Nissen
|
8
|
+
- Sandeep Singh
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2018-
|
12
|
+
date: 2018-09-07 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -66,6 +67,20 @@ dependencies:
|
|
66
67
|
- - "~>"
|
67
68
|
- !ruby/object:Gem::Version
|
68
69
|
version: '1.3'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rubyzip
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.2.2
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 1.2.2
|
69
84
|
- !ruby/object:Gem::Dependency
|
70
85
|
name: watir
|
71
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,6 +140,7 @@ dependencies:
|
|
125
140
|
description:
|
126
141
|
email:
|
127
142
|
- scnissen@gmail.com
|
143
|
+
- sandeepnagra@gmail.com
|
128
144
|
executables: []
|
129
145
|
extensions: []
|
130
146
|
extra_rdoc_files: []
|
@@ -134,7 +150,6 @@ files:
|
|
134
150
|
- ".travis.yml"
|
135
151
|
- CODE_OF_CONDUCT.md
|
136
152
|
- Gemfile
|
137
|
-
- Gemfile.lock
|
138
153
|
- LICENSE.txt
|
139
154
|
- README.md
|
140
155
|
- Rakefile
|
@@ -166,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
181
|
version: '0'
|
167
182
|
requirements: []
|
168
183
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.5.2.3
|
170
185
|
signing_key:
|
171
186
|
specification_version: 4
|
172
187
|
summary: Extends Watir to take stitched-together screenshots of full web pages.
|
data/Gemfile.lock
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
watir-screenshot-stitch (0.6.7)
|
5
|
-
binding_of_caller (~> 0.7)
|
6
|
-
mini_magick (~> 4.0)
|
7
|
-
os (~> 1.0)
|
8
|
-
watir (~> 6.4)
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: https://rubygems.org/
|
12
|
-
specs:
|
13
|
-
binding_of_caller (0.8.0)
|
14
|
-
debug_inspector (>= 0.0.1)
|
15
|
-
childprocess (0.9.0)
|
16
|
-
ffi (~> 1.0, >= 1.0.11)
|
17
|
-
chunky_png (1.3.10)
|
18
|
-
debug_inspector (0.0.3)
|
19
|
-
diff-lcs (1.3)
|
20
|
-
ffi (1.9.25)
|
21
|
-
mini_magick (4.8.0)
|
22
|
-
os (1.0.0)
|
23
|
-
rake (10.5.0)
|
24
|
-
rspec (3.7.0)
|
25
|
-
rspec-core (~> 3.7.0)
|
26
|
-
rspec-expectations (~> 3.7.0)
|
27
|
-
rspec-mocks (~> 3.7.0)
|
28
|
-
rspec-core (3.7.1)
|
29
|
-
rspec-support (~> 3.7.0)
|
30
|
-
rspec-expectations (3.7.0)
|
31
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.7.0)
|
33
|
-
rspec-mocks (3.7.0)
|
34
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.7.0)
|
36
|
-
rspec-support (3.7.0)
|
37
|
-
rubyzip (1.2.1)
|
38
|
-
selenium-webdriver (3.14.0)
|
39
|
-
childprocess (~> 0.5)
|
40
|
-
rubyzip (~> 1.2)
|
41
|
-
watir (6.12.0)
|
42
|
-
selenium-webdriver (~> 3.4, >= 3.4.1)
|
43
|
-
|
44
|
-
PLATFORMS
|
45
|
-
ruby
|
46
|
-
|
47
|
-
DEPENDENCIES
|
48
|
-
bundler (~> 1.16)
|
49
|
-
chunky_png (~> 1.3)
|
50
|
-
rake (~> 10.0)
|
51
|
-
rspec (~> 3.0)
|
52
|
-
watir-screenshot-stitch!
|
53
|
-
|
54
|
-
BUNDLED WITH
|
55
|
-
1.16.2
|