ferrum 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ferrum/target.rb +10 -2
- data/lib/ferrum/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: 9c0325708ecf4ff29cd0d11a3527207271a1a9a76c945a321810b7f37325c538
|
4
|
+
data.tar.gz: 9d2f4790ef55ddfb55f1588473dc94511fc95fe7c7cc937f0e49af0980457b9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8067b96de131a957317d641afeec6d145f47455b18eb119227dc1de184ed35b8b6a6cbf84aa8e1e6b3c87ff190b2218c68dd43cb1c9187fe7e7acea2cae1ca89
|
7
|
+
data.tar.gz: a4fb8e6749da0fa5ccbf1ab05c807f176e30c2650e23b263072281065b5ca9632201a596652989636f7b9f565ac8a23ca391e8d366d755538e7b28504b09209b
|
data/lib/ferrum/target.rb
CHANGED
@@ -4,6 +4,10 @@ module Ferrum
|
|
4
4
|
class Target
|
5
5
|
NEW_WINDOW_WAIT = ENV.fetch("FERRUM_NEW_WINDOW_WAIT", 0.3).to_f
|
6
6
|
|
7
|
+
# You can create page yourself and assign it to target, used in cuprite
|
8
|
+
# where we enhance page class and build page ourselves.
|
9
|
+
attr_writer :page
|
10
|
+
|
7
11
|
def initialize(browser, params = nil)
|
8
12
|
@browser = browser
|
9
13
|
@params = params
|
@@ -19,8 +23,7 @@ module Ferrum
|
|
19
23
|
|
20
24
|
def page
|
21
25
|
@page ||= begin
|
22
|
-
|
23
|
-
sleep(NEW_WINDOW_WAIT) if window?
|
26
|
+
maybe_sleep_if_new_window
|
24
27
|
Page.new(id, @browser)
|
25
28
|
end
|
26
29
|
end
|
@@ -52,5 +55,10 @@ module Ferrum
|
|
52
55
|
def window?
|
53
56
|
!!opener_id
|
54
57
|
end
|
58
|
+
|
59
|
+
def maybe_sleep_if_new_window
|
60
|
+
# Dirty hack because new window doesn't have events at all
|
61
|
+
sleep(NEW_WINDOW_WAIT) if window?
|
62
|
+
end
|
55
63
|
end
|
56
64
|
end
|
data/lib/ferrum/version.rb
CHANGED