ferrum-har 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ferrum/har/command_extension.rb +8 -0
- data/lib/ferrum/har/page_extension.rb +11 -6
- data/lib/ferrum/har/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90c64095f327010a5364542de46bdb7eb2b5af3bbb401b0d643438900311c8ea
|
4
|
+
data.tar.gz: b53a43f0a6198c95cb20968ba4bd941ac8b085484e4592bc5853a72716a29043
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcf185fd1cd4b579fc0a1a2a57169285f7333f189eb8eeebd11d61202a8fc797bcce03db925e522dfa381f83f84038ce9b41fdced0957e7d8a4af3477fb88581
|
7
|
+
data.tar.gz: 951491f82275957ad30ea99a8e50f07867388744173e360f887558259bc6a252cffa2e96d99f2eb3ae8ee16b93c93ce1b44ce186a49093b6110acbff7dc4ea89
|
@@ -19,6 +19,14 @@ module Ferrum
|
|
19
19
|
Gem::Version.new(p.split("/")[1])
|
20
20
|
}
|
21
21
|
end
|
22
|
+
|
23
|
+
return if @path
|
24
|
+
|
25
|
+
raise <<~ERR
|
26
|
+
Browser path not found. Please set BROWSER_PATH environment variable, or trigger a download of Chrome Testing by using:
|
27
|
+
|
28
|
+
bundle exec rake chrome:install
|
29
|
+
ERR
|
22
30
|
end
|
23
31
|
|
24
32
|
private def check_har_related_browser_options(options)
|
@@ -12,7 +12,7 @@ module Ferrum
|
|
12
12
|
def har
|
13
13
|
network.wait_for_idle
|
14
14
|
execute("document.ferrumHarRequested = true;")
|
15
|
-
|
15
|
+
har_hash_result = Ferrum::Utils::Attempt.with_retry(
|
16
16
|
errors: [HarNotReadyError],
|
17
17
|
# 10 seconds
|
18
18
|
max: 20,
|
@@ -21,13 +21,18 @@ module Ferrum
|
|
21
21
|
found = evaluate("document.ferrumHar;")
|
22
22
|
raise HarNotReadyError unless found
|
23
23
|
|
24
|
-
found
|
24
|
+
inlined_har = Base64.decode64(found)
|
25
|
+
har_hash = JSON.parse(inlined_har)
|
26
|
+
raise HarNotReadyError, "Result does not appear to be a HAR" unless har_hash.key?("log")
|
27
|
+
|
28
|
+
entries = har_hash.dig("log", "entries")
|
29
|
+
# If entries is nil or empty, the HAR is not ready yet.
|
30
|
+
raise HarNotReadyError if entries.nil? || entries.empty?
|
31
|
+
|
32
|
+
har_hash
|
25
33
|
end
|
26
|
-
inlined_har = Base64.decode64(base64_encoded_har)
|
27
|
-
har_hash = JSON.parse(inlined_har)
|
28
|
-
raise "Result does not appear to be a HAR" unless har_hash.key?("log")
|
29
34
|
|
30
|
-
JSON.pretty_generate(
|
35
|
+
JSON.pretty_generate(har_hash_result)
|
31
36
|
end
|
32
37
|
end
|
33
38
|
end
|
data/lib/ferrum/har/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ferrum-har
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Lascelles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|