watir-screenshot-stitch 0.7.1 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -16
- data/lib/watir-screenshot-stitch.rb +5 -6
- data/lib/watir-screenshot-stitch/version.rb +1 -1
- data/watir-screenshot-stitch.gemspec +2 -2
- metadata +13 -15
- data/lib/watir-screenshot-stitch/utilities.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 646fc05a368bd1375a2540b88a6ef33a62a21959dc93592341f27165455a57e7
|
4
|
+
data.tar.gz: 107bbca20ce5796b473b3a83c2ba87a466e164cf6bc603b580e376fd90523121
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23fcc38f539f8d36fb0cf2f503603ae22de6ee4eb04a22da703980ff52c650fadb1a6609d009cca8917526172ef42d3983b9d8a7a9befbff11d03cbcbc038a91
|
7
|
+
data.tar.gz: e23757fc55be1aa3c05051afa7e254475c648a44a2134c35d6341aa918329077e39e69afbebed22971a1c020bf6f5b2ce0ad828d5bebb65bc6f7ab6fd382afe5
|
data/README.md
CHANGED
@@ -1,21 +1,19 @@
|
|
1
1
|
# watir-screenshot-stitch
|
2
2
|
|
3
3
|
watir-screenshot-stitch attempts to compensate for
|
4
|
-
|
5
|
-
|
6
|
-
via geckodriver.
|
4
|
+
the lack of full page screenshot functionality
|
5
|
+
in Selenium Webdriver.
|
7
6
|
|
8
|
-
|
9
|
-
by the size of the viewport, capturing the entire page in the process,
|
10
|
-
up to the maximum height — see below.
|
7
|
+
It does so in three ways:
|
11
8
|
|
12
|
-
|
9
|
+
* Directly employing geckodriver's new full page screenshot
|
10
|
+
functionality (only on Firefox).
|
11
|
+
* Screenshot stitching, paging down a given URL by the size
|
12
|
+
of the viewport, capturing screenshots and adjoining them.
|
13
|
+
* Employing a bundled
|
13
14
|
[html2canvas](https://github.com/niklasvh/html2canvas)
|
14
|
-
script
|
15
|
-
|
16
|
-
and running out of memory but has limitations with certain element
|
17
|
-
types not being properly displayed. See their documentation for
|
18
|
-
more information.
|
15
|
+
script against the page to generate a png from a `canvas`
|
16
|
+
element.
|
19
17
|
|
20
18
|
## Installation
|
21
19
|
|
@@ -110,7 +108,7 @@ will return a base64 encoded image blob of the given site.
|
|
110
108
|
|
111
109
|
In can be saved as a PNG by doing:
|
112
110
|
```ruby
|
113
|
-
png = b.screenshot.
|
111
|
+
png = b.screenshot.base64_geckodriver
|
114
112
|
path = "/my/path/image.png"
|
115
113
|
File.open(path, 'wb') { |f| f.write(Base64.decode64(png)) }
|
116
114
|
```
|
@@ -164,6 +162,12 @@ path = "/my/path/image.png"
|
|
164
162
|
File.open(path, 'wb') { |f| f.write(Base64.decode64(png)) }
|
165
163
|
```
|
166
164
|
|
165
|
+
This method of screenshotting
|
166
|
+
is less likely to have issues with stitching the images together,
|
167
|
+
and running out of memory but has limitations with certain element
|
168
|
+
types not being properly displayed. See their documentation for
|
169
|
+
more information.
|
170
|
+
|
167
171
|
### Doubling resolution calculations, including macOS Retina
|
168
172
|
|
169
173
|
watir-screenshot-stitch uses CSS selectors to determine whether a
|
@@ -182,9 +186,9 @@ A hash of key value pairs.
|
|
182
186
|
Should refer to a positive Integer greater than the viewport height.
|
183
187
|
|
184
188
|
### Maximum height
|
185
|
-
ImageMagick has a maximum pixel dimension of 65500, and all
|
186
|
-
will be capped to a maximum height of 65500 regardless
|
187
|
-
to avoid errors.
|
189
|
+
ImageMagick has a maximum pixel dimension of 65500, and all stitched
|
190
|
+
screenshots will be capped to a maximum height of 65500 regardless
|
191
|
+
of any options to avoid errors.
|
188
192
|
|
189
193
|
## Development
|
190
194
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require "time"
|
2
2
|
require "watir-screenshot-stitch/version"
|
3
|
-
require "watir-screenshot-stitch/utilities"
|
4
3
|
require "watir"
|
5
4
|
require "mini_magick"
|
6
5
|
require "os"
|
@@ -149,8 +148,8 @@ module Watir
|
|
149
148
|
end
|
150
149
|
|
151
150
|
def webdrivers_defined?
|
152
|
-
|
153
|
-
rescue
|
151
|
+
Object.const_get("Webdrivers")
|
152
|
+
rescue NameError
|
154
153
|
nil
|
155
154
|
end
|
156
155
|
|
@@ -205,10 +204,10 @@ module Watir
|
|
205
204
|
def html2canvas_payload
|
206
205
|
case @browser.driver.browser
|
207
206
|
when :firefox
|
208
|
-
path = File.
|
207
|
+
path = File.expand_path("../../vendor/html2canvas-0.4.1.js", __FILE__)
|
209
208
|
File.read(path)
|
210
209
|
else
|
211
|
-
path = File.
|
210
|
+
path = File.expand_path("../../vendor/html2canvas.js", __FILE__)
|
212
211
|
File.read(path)
|
213
212
|
end
|
214
213
|
end
|
@@ -240,7 +239,7 @@ module Watir
|
|
240
239
|
def build_canvas
|
241
240
|
@start = MiniMagick::Image.read(Base64.decode64(self.base64))
|
242
241
|
@combined_screenshot = MiniMagick::Image.new(@path)
|
243
|
-
@combined_screenshot.run_command(:convert, "-size", "#{ @start.width }x#{ @page_height*@mac_factor }", "xc:white", @combined_screenshot.path)
|
242
|
+
@combined_screenshot.run_command(:convert, "-size", "#{ @start.width }x#{ @page_height*@mac_factor }", "xc:white", "-define", "png:color-type=6", @combined_screenshot.path)
|
244
243
|
end
|
245
244
|
|
246
245
|
def gather_slices
|
@@ -30,13 +30,13 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
spec.add_development_dependency "bundler", "~> 1.16"
|
33
|
-
spec.add_development_dependency "rake", "
|
33
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
34
34
|
spec.add_development_dependency "rspec", "~> 3.0"
|
35
35
|
spec.add_development_dependency "chunky_png", "~> 1.3"
|
36
36
|
|
37
37
|
spec.required_ruby_version = '>= 2.3.0'
|
38
38
|
|
39
|
-
spec.add_dependency "rubyzip", "~>
|
39
|
+
spec.add_dependency "rubyzip", "~> 2.0"
|
40
40
|
spec.add_dependency "watir", "~> 6.12"
|
41
41
|
spec.add_dependency "mini_magick", "~> 4.0"
|
42
42
|
spec.add_dependency "os", "~> 1.0"
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-screenshot-stitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Nissen
|
8
8
|
- Sandeep Singh
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -29,16 +29,16 @@ dependencies:
|
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 12.3.3
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 12.3.3
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '2.0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '2.0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: watir
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0.7'
|
140
|
-
description:
|
140
|
+
description:
|
141
141
|
email:
|
142
142
|
- scnissen@gmail.com
|
143
143
|
- sandeepnagra@gmail.com
|
@@ -156,7 +156,6 @@ files:
|
|
156
156
|
- bin/console
|
157
157
|
- bin/setup
|
158
158
|
- lib/watir-screenshot-stitch.rb
|
159
|
-
- lib/watir-screenshot-stitch/utilities.rb
|
160
159
|
- lib/watir-screenshot-stitch/version.rb
|
161
160
|
- vendor/html2canvas-0.4.1.js
|
162
161
|
- vendor/html2canvas.js
|
@@ -165,7 +164,7 @@ homepage: https://github.com/samnissen/watir-screenshot-stitch
|
|
165
164
|
licenses:
|
166
165
|
- MIT
|
167
166
|
metadata: {}
|
168
|
-
post_install_message:
|
167
|
+
post_install_message:
|
169
168
|
rdoc_options: []
|
170
169
|
require_paths:
|
171
170
|
- lib
|
@@ -180,9 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
179
|
- !ruby/object:Gem::Version
|
181
180
|
version: '0'
|
182
181
|
requirements: []
|
183
|
-
|
184
|
-
|
185
|
-
signing_key:
|
182
|
+
rubygems_version: 3.1.2
|
183
|
+
signing_key:
|
186
184
|
specification_version: 4
|
187
185
|
summary: Extends Watir to take stitched-together screenshots of full web pages.
|
188
186
|
test_files: []
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module WatirScreenshotStitch
|
2
|
-
module Utilities
|
3
|
-
# Return a directory with the project libraries.
|
4
|
-
def self.directory
|
5
|
-
t = ["#{File.dirname(File.expand_path($0))}/../lib/#{WatirScreenshotStitch::NAME}",
|
6
|
-
"#{Gem.dir}/gems/#{WatirScreenshotStitch::NAME}-#{WatirScreenshotStitch::VERSION}"]
|
7
|
-
t.each {|i| return i if File.readable?(i) }
|
8
|
-
raise "watir-screenshot-stitch could not be found in: #{t}"
|
9
|
-
end # https://stackoverflow.com/a/5805783/1651458
|
10
|
-
end
|
11
|
-
end
|