smartshot 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/bin/phantomjs-32 +0 -0
- data/bin/phantomjs-64 +0 -0
- data/lib/smartshot/screenshot.rb +3 -1
- data/lib/smartshot/version.rb +1 -1
- data/test/smartshot_test.rb +2 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25fbd0bb4b2dd0146e8cc472cc562279d8e07fa9
|
4
|
+
data.tar.gz: b6a2d9c4a6f2f07fb227d31dca08b2d936e2b071
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4826398f418533772f2ddd1f1ec0c00fb56d743eda1a5dcb36f32abefa258be00acb2c2939d74d9d64f1b638f86d1fea6a89dee47d2c89e29c9041e87b7512b9
|
7
|
+
data.tar.gz: 6afe330171bca59c2843a5f16f6e4fff0e0b446b56911a7244d04346154f8d30bc85c60983caa0a93daadd8d193c84f2ab7e01d638347dfd719ee63055ec940c
|
data/README.md
CHANGED
@@ -47,6 +47,9 @@ fetcher.take_screenshot! url: 'http://some.page.with/deep/iframes',
|
|
47
47
|
|
48
48
|
# It's also possible to just wait for some time (for example, 5 seconds)
|
49
49
|
fetcher.take_screenshot! url: 'http://google.com', output: '/tmp/google.png', sleep: 5
|
50
|
+
|
51
|
+
# You can also wait for multiple elements instead of just one
|
52
|
+
fetcher.take_screenshot! wait_for_element: ['p.first', 'div#container']
|
50
53
|
```
|
51
54
|
|
52
55
|
Besides the five custom options presented so far, it's possible to pass the same options accepted by
|
data/bin/phantomjs-32
ADDED
Binary file
|
data/bin/phantomjs-64
ADDED
Binary file
|
data/lib/smartshot/screenshot.rb
CHANGED
@@ -21,7 +21,9 @@ module Smartshot
|
|
21
21
|
begin
|
22
22
|
visit options.delete(:url)
|
23
23
|
inside_frames options.delete(:frames_path) do
|
24
|
-
|
24
|
+
[options.delete(:wait_for_element)].flatten.each do |element|
|
25
|
+
page.find element
|
26
|
+
end
|
25
27
|
end
|
26
28
|
|
27
29
|
timeout = options.delete(:sleep)
|
data/lib/smartshot/version.rb
CHANGED
data/test/smartshot_test.rb
CHANGED
@@ -3,10 +3,11 @@ require 'test_helper'
|
|
3
3
|
class SmartshotTest < MiniTest::Unit::TestCase
|
4
4
|
|
5
5
|
DATA_DIR = File.expand_path(File.dirname(__FILE__) + '/data')
|
6
|
+
PHANTOMJS_DIR = File.expand_path(File.dirname(__FILE__) + '/../bin/phantomjs-' + (1.size * 8).to_s)
|
6
7
|
|
7
8
|
def setup
|
8
9
|
FileUtils.mkdir_p(DATA_DIR) unless File.directory?(DATA_DIR)
|
9
|
-
@smartshot = Smartshot::Screenshot.new
|
10
|
+
@smartshot = Smartshot::Screenshot.new(phantomjs: PHANTOMJS_DIR)
|
10
11
|
end
|
11
12
|
|
12
13
|
def test_http
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caio Almeida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -99,7 +99,9 @@ description: |-
|
|
99
99
|
optionally waiting for elements (defined by CSS selectors) that can be inside iframes
|
100
100
|
email:
|
101
101
|
- caiosba@gmail.com
|
102
|
-
executables:
|
102
|
+
executables:
|
103
|
+
- phantomjs-32
|
104
|
+
- phantomjs-64
|
103
105
|
extensions: []
|
104
106
|
extra_rdoc_files: []
|
105
107
|
files:
|
@@ -109,6 +111,8 @@ files:
|
|
109
111
|
- LICENSE.txt
|
110
112
|
- README.md
|
111
113
|
- Rakefile
|
114
|
+
- bin/phantomjs-32
|
115
|
+
- bin/phantomjs-64
|
112
116
|
- lib/smartshot.rb
|
113
117
|
- lib/smartshot/errors.rb
|
114
118
|
- lib/smartshot/screenshot.rb
|