leash-integration-puppeteer 0.1.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 +7 -0
- data/lib/leash/integration/puppeteer.rb +109 -0
- metadata +57 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: fca65a0c789a4848a73523c9b78b94566c842e2582c15af1ea2f9c21fa03ffbe
|
|
4
|
+
data.tar.gz: a5b8dbae42a866838221e47fcf42f4698ad9e37899a0f29edb0b4a922e41a710
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6b8efa915e4bed8a1bd1113e60ad541ff2639c3a600cd7664832f3c73c25df309ddda05cc25ad37cd158e721b19c96137b6cb972f8f77e3536efae6ae923d9a2
|
|
7
|
+
data.tar.gz: 599b67c749683096d29c008cd556590660a51a68efb2eb6fd8c2fb0523aeaf7e4fbeeaefa595f8098bcbeb4889bb8f49e8aeba0cb44b5a23af0f59df29bd44c1
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated by leash-codegen — do not edit manually
|
|
4
|
+
|
|
5
|
+
module Leash
|
|
6
|
+
module Integration
|
|
7
|
+
class PuppeteerClient
|
|
8
|
+
# Create a new Puppeteer integration client.
|
|
9
|
+
#
|
|
10
|
+
# @param leash [Leash::Client] the Leash SDK client
|
|
11
|
+
def initialize(leash)
|
|
12
|
+
@leash = leash
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Navigate to a URL
|
|
16
|
+
#
|
|
17
|
+
# @param url [String] URL to navigate to
|
|
18
|
+
# @param launchoptions [Hash, nil] PuppeteerJS LaunchOptions. Default null. If changed and not null, browser restarts. Example: { headless: true, args: ['--no-sandbox'] }
|
|
19
|
+
# @param allowdangerous [Boolean, nil] Allow dangerous LaunchOptions that reduce security. When false, dangerous args like --no-sandbox will throw errors. Default false.
|
|
20
|
+
# @return [Object]
|
|
21
|
+
def puppeteer_navigate(url, launchoptions: nil, allowdangerous: nil)
|
|
22
|
+
params = {
|
|
23
|
+
'url' => url,
|
|
24
|
+
'launchOptions' => launchoptions,
|
|
25
|
+
'allowDangerous' => allowdangerous
|
|
26
|
+
}.compact
|
|
27
|
+
@leash.call('puppeteer', 'puppeteer_navigate', params)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Take a screenshot of the current page or a specific element
|
|
31
|
+
#
|
|
32
|
+
# @param name [String] Name for the screenshot
|
|
33
|
+
# @param selector [String, nil] CSS selector for element to screenshot
|
|
34
|
+
# @param width [Float, nil] Width in pixels (default: 800)
|
|
35
|
+
# @param height [Float, nil] Height in pixels (default: 600)
|
|
36
|
+
# @param encoded [Boolean, nil] If true, capture the screenshot as a base64-encoded data URI (as text) instead of binary image content. Default false.
|
|
37
|
+
# @return [Object]
|
|
38
|
+
def puppeteer_screenshot(name, selector: nil, width: nil, height: nil, encoded: nil)
|
|
39
|
+
params = {
|
|
40
|
+
'name' => name,
|
|
41
|
+
'selector' => selector,
|
|
42
|
+
'width' => width,
|
|
43
|
+
'height' => height,
|
|
44
|
+
'encoded' => encoded
|
|
45
|
+
}.compact
|
|
46
|
+
@leash.call('puppeteer', 'puppeteer_screenshot', params)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Click an element on the page
|
|
50
|
+
#
|
|
51
|
+
# @param selector [String] CSS selector for element to click
|
|
52
|
+
# @return [Object]
|
|
53
|
+
def puppeteer_click(selector)
|
|
54
|
+
params = {
|
|
55
|
+
'selector' => selector
|
|
56
|
+
}.compact
|
|
57
|
+
@leash.call('puppeteer', 'puppeteer_click', params)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Fill out an input field
|
|
61
|
+
#
|
|
62
|
+
# @param selector [String] CSS selector for input field
|
|
63
|
+
# @param value [String] Value to fill
|
|
64
|
+
# @return [Object]
|
|
65
|
+
def puppeteer_fill(selector, value)
|
|
66
|
+
params = {
|
|
67
|
+
'selector' => selector,
|
|
68
|
+
'value' => value
|
|
69
|
+
}.compact
|
|
70
|
+
@leash.call('puppeteer', 'puppeteer_fill', params)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Select an element on the page with Select tag
|
|
74
|
+
#
|
|
75
|
+
# @param selector [String] CSS selector for element to select
|
|
76
|
+
# @param value [String] Value to select
|
|
77
|
+
# @return [Object]
|
|
78
|
+
def puppeteer_select(selector, value)
|
|
79
|
+
params = {
|
|
80
|
+
'selector' => selector,
|
|
81
|
+
'value' => value
|
|
82
|
+
}.compact
|
|
83
|
+
@leash.call('puppeteer', 'puppeteer_select', params)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Hover an element on the page
|
|
87
|
+
#
|
|
88
|
+
# @param selector [String] CSS selector for element to hover
|
|
89
|
+
# @return [Object]
|
|
90
|
+
def puppeteer_hover(selector)
|
|
91
|
+
params = {
|
|
92
|
+
'selector' => selector
|
|
93
|
+
}.compact
|
|
94
|
+
@leash.call('puppeteer', 'puppeteer_hover', params)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Execute JavaScript in the browser console
|
|
98
|
+
#
|
|
99
|
+
# @param script [String] JavaScript code to execute
|
|
100
|
+
# @return [Object]
|
|
101
|
+
def puppeteer_evaluate(script)
|
|
102
|
+
params = {
|
|
103
|
+
'script' => script
|
|
104
|
+
}.compact
|
|
105
|
+
@leash.call('puppeteer', 'puppeteer_evaluate', params)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: leash-integration-puppeteer
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Leash
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-04-14 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: leash-sdk
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.2.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.2.0
|
|
27
|
+
description: Auto-generated typed client for the Puppeteer integration on Leash.
|
|
28
|
+
email:
|
|
29
|
+
executables: []
|
|
30
|
+
extensions: []
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
files:
|
|
33
|
+
- lib/leash/integration/puppeteer.rb
|
|
34
|
+
homepage: https://github.com/leash-build/leash-codegen
|
|
35
|
+
licenses:
|
|
36
|
+
- Apache-2.0
|
|
37
|
+
metadata: {}
|
|
38
|
+
post_install_message:
|
|
39
|
+
rdoc_options: []
|
|
40
|
+
require_paths:
|
|
41
|
+
- lib
|
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 2.7.0
|
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
|
+
requirements:
|
|
49
|
+
- - ">="
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '0'
|
|
52
|
+
requirements: []
|
|
53
|
+
rubygems_version: 3.0.3.1
|
|
54
|
+
signing_key:
|
|
55
|
+
specification_version: 4
|
|
56
|
+
summary: Typed Puppeteer integration for Leash
|
|
57
|
+
test_files: []
|