rubium 0.2.1 → 0.3.0
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/CHANGELOG.md +8 -0
- data/lib/rubium/browser.rb +12 -6
- data/lib/rubium/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: 578d3543ceff2361188340f76906d497b68a81bd7fae58ea0a07b07b1911d376
|
|
4
|
+
data.tar.gz: 9b4f4f016e5af7a935ef52f469939ac9e4c8f7c399f8c2105fb6c2f4b3c8df4e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e3efeeab3587f3cfdc3c578469d99f2004d59720161b492759bac5d5ade74d33147ca9ced2838e6d7c31b4a08b510d7b89358c5628fbd088eab4aa9a2f0039fd
|
|
7
|
+
data.tar.gz: 55f45b10d25cf66cd8517933bf0b44a15ebf21c98ee2831fe040d4a19188fc9f4bcc7ee1f0c8cd9fbd53b7b4f3690cd185fcfd1b3d73bd1a282bddab8d8d2a22
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.0] - 2025-12-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Autofetch chrome path on MacOS
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- Use backticks inside 'Runtime.evaluate' for better compatibility
|
|
15
|
+
|
|
8
16
|
## [0.2.1] - 2025-12-07
|
|
9
17
|
|
|
10
18
|
### Added
|
data/lib/rubium/browser.rb
CHANGED
|
@@ -139,7 +139,7 @@ module Rubium
|
|
|
139
139
|
|
|
140
140
|
def click(selector)
|
|
141
141
|
@client.send_cmd "Runtime.evaluate", expression: <<~js
|
|
142
|
-
document.querySelector(
|
|
142
|
+
document.querySelector(`#{selector}`).click();
|
|
143
143
|
js
|
|
144
144
|
end
|
|
145
145
|
|
|
@@ -147,7 +147,7 @@ module Rubium
|
|
|
147
147
|
# https://stackoverflow.com/a/18937620
|
|
148
148
|
def send_key_on(selector, key)
|
|
149
149
|
@client.send_cmd "Runtime.evaluate", expression: <<~js
|
|
150
|
-
document.querySelector(
|
|
150
|
+
document.querySelector(`#{selector}`).dispatchEvent(
|
|
151
151
|
new KeyboardEvent("keydown", {
|
|
152
152
|
bubbles: true, cancelable: true, keyCode: #{key}
|
|
153
153
|
})
|
|
@@ -178,7 +178,7 @@ module Rubium
|
|
|
178
178
|
|
|
179
179
|
def fill_in(selector, text)
|
|
180
180
|
execute_script <<~js
|
|
181
|
-
document.querySelector(
|
|
181
|
+
document.querySelector(`#{selector}`).value = "#{text}"
|
|
182
182
|
js
|
|
183
183
|
end
|
|
184
184
|
|
|
@@ -195,9 +195,7 @@ module Rubium
|
|
|
195
195
|
|
|
196
196
|
@data_dir = options[:data_dir] || "/tmp/rubium_profile_#{SecureRandom.hex}"
|
|
197
197
|
|
|
198
|
-
chrome_path =
|
|
199
|
-
Cliver.detect("chromium-browser") ||
|
|
200
|
-
Cliver.detect("google-chrome")
|
|
198
|
+
chrome_path = get_chrome_path
|
|
201
199
|
raise ConfigurationError, "Can't find chrome executable" unless chrome_path
|
|
202
200
|
|
|
203
201
|
command = %W(
|
|
@@ -262,6 +260,14 @@ module Rubium
|
|
|
262
260
|
logger.info "Opened browser" if options[:enable_logger]
|
|
263
261
|
end
|
|
264
262
|
|
|
263
|
+
def get_chrome_path
|
|
264
|
+
path = Rubium.configuration.chrome_path || Cliver.detect("chromium-browser") || Cliver.detect("google-chrome")
|
|
265
|
+
return path if path
|
|
266
|
+
|
|
267
|
+
macos_path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
268
|
+
macos_path if File.executable?(macos_path)
|
|
269
|
+
end
|
|
270
|
+
|
|
265
271
|
def convert_proxy(proxy_string)
|
|
266
272
|
ip, port, type, user, password = proxy_string.split(":")
|
|
267
273
|
"#{type}://#{ip}:#{port}"
|
data/lib/rubium/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubium
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Victor Afanasev
|
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
144
144
|
- !ruby/object:Gem::Version
|
|
145
145
|
version: '0'
|
|
146
146
|
requirements: []
|
|
147
|
-
rubygems_version:
|
|
147
|
+
rubygems_version: 4.0.1
|
|
148
148
|
specification_version: 4
|
|
149
149
|
summary: Headless Chromium Ruby API based on ChromeRemote gem
|
|
150
150
|
test_files: []
|