browserbeam 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15e5f1fad0f6f29ae8ce9616b429a9078771a1d6911a220e32b5f230c12ca02a
4
- data.tar.gz: 18116e46d6cabbc54716f800964ae354a993cead2f1c44d2edf0e97bbc1f2656
3
+ metadata.gz: 968540abd1c037b539260f27cf439d8f49d05a25f16e398cd56f56dc6d2c4591
4
+ data.tar.gz: fb7920bc04046dd96d62277826d2e3b4a83fce58d96961b65643686326c510d3
5
5
  SHA512:
6
- metadata.gz: b8b82446fe2731ac36af5d52ee59706a43cc0e7214d404b066d472bb520cac5565a9eb04d1287858077b085e26bb0771f55cdfd3de3e63275e562859caeadd0b
7
- data.tar.gz: d5f19a469e10f1eb4ff9225c24e5bb44155504a26a6d936be209f48efa4bbc0f4a1c46516b25f7c540bacdfc83f04b1ba3a72ddce54318c11e0926a522204ae2
6
+ metadata.gz: bfe0019f622ff4273922faa8bc386264e013c33706f4ae3fe4921c68e04a42e9b7340b61874801df22d14efbc98529de2b5ef6937469e857f78377461a8a8f66
7
+ data.tar.gz: f4708420e29384d4a70d4ec10fe21d1d0b43a9cd83a9973c35d90991337e4175e1cd693da190cf0271d2e65b132958c1425ef1bd0b811171c18f12fd82aeee7e
data/README.md CHANGED
@@ -84,7 +84,7 @@ session = client.sessions.create(
84
84
  | `session.fill_form(fields, submit:)` | Fill and submit a form |
85
85
  | `session.wait(ms:)` | Wait for time, selector, or text |
86
86
  | `session.pdf` | Generate a PDF |
87
- | `session.execute_js(expr)` | Run JavaScript |
87
+ | `session.execute_js(code)` | Run JavaScript |
88
88
  | `session.close` | Close the session |
89
89
 
90
90
  ## Session Management
@@ -19,9 +19,10 @@ module Browserbeam
19
19
  envelope
20
20
  end
21
21
 
22
- def goto(url, wait_for: nil, wait_timeout: nil)
22
+ def goto(url, wait_for: nil, wait_until: nil, wait_timeout: nil)
23
23
  params = { url: url }
24
24
  params[:wait_for] = wait_for if wait_for
25
+ params[:wait_until] = wait_until if wait_until
25
26
  params[:wait_timeout] = wait_timeout if wait_timeout
26
27
  act([{ goto: params }])
27
28
  end
@@ -43,43 +44,49 @@ module Browserbeam
43
44
  act([{ click: params }])
44
45
  end
45
46
 
46
- def fill(value, ref: nil, label: nil)
47
+ def fill(value, ref: nil, text: nil, label: nil)
47
48
  params = { value: value }
48
49
  params[:ref] = ref if ref
50
+ params[:text] = text if text
49
51
  params[:label] = label if label
50
52
  act([{ fill: params }])
51
53
  end
52
54
 
53
- def type(value, label: nil, ref: nil, delay: nil)
55
+ def type(value, ref: nil, text: nil, label: nil, delay: nil)
54
56
  params = { value: value }
55
- params[:label] = label if label
56
57
  params[:ref] = ref if ref
58
+ params[:text] = text if text
59
+ params[:label] = label if label
57
60
  params[:delay] = delay if delay
58
61
  act([{ type: params }])
59
62
  end
60
63
 
61
- def select(value, label: nil, ref: nil)
64
+ def select(value, ref: nil, text: nil, label: nil)
62
65
  params = { value: value }
63
- params[:label] = label if label
64
66
  params[:ref] = ref if ref
67
+ params[:text] = text if text
68
+ params[:label] = label if label
65
69
  act([{ select: params }])
66
70
  end
67
71
 
68
- def check(label: nil, ref: nil, checked: nil)
72
+ def check(ref: nil, text: nil, label: nil, checked: nil)
69
73
  params = {}
70
- params[:label] = label if label
71
74
  params[:ref] = ref if ref
75
+ params[:text] = text if text
76
+ params[:label] = label if label
72
77
  params[:checked] = checked unless checked.nil?
73
78
  act([{ check: params }])
74
79
  end
75
80
 
76
- def scroll(to: nil, direction: nil, amount: nil, times: nil, ref: nil)
81
+ def scroll(to: nil, direction: nil, amount: nil, times: nil, ref: nil, text: nil, label: nil)
77
82
  params = {}
78
83
  params[:to] = to if to
79
84
  params[:direction] = direction if direction
80
85
  params[:amount] = amount if amount
81
86
  params[:times] = times if times
82
87
  params[:ref] = ref if ref
88
+ params[:text] = text if text
89
+ params[:label] = label if label
83
90
  act([{ scroll: params }])
84
91
  end
85
92
 
@@ -101,11 +108,12 @@ module Browserbeam
101
108
  act([{ screenshot: params }])
102
109
  end
103
110
 
104
- def wait(ms: nil, selector: nil, text: nil, timeout: nil)
111
+ def wait(ms: nil, selector: nil, text: nil, timeout: nil, **opts)
105
112
  params = {}
106
113
  params[:ms] = ms if ms
107
114
  params[:selector] = selector if selector
108
115
  params[:text] = text if text
116
+ params[:until] = opts[:until] if opts[:until]
109
117
  params[:timeout] = timeout if timeout
110
118
  act([{ wait: params }])
111
119
  end
@@ -120,20 +128,29 @@ module Browserbeam
120
128
  act([{ fill_form: params }])
121
129
  end
122
130
 
123
- def upload(ref, files)
124
- act([{ upload: { ref: ref, files: files } }])
131
+ def upload(files, ref: nil, text: nil, label: nil)
132
+ params = { files: files }
133
+ params[:ref] = ref if ref
134
+ params[:text] = text if text
135
+ params[:label] = label if label
136
+ act([{ upload: params }])
125
137
  end
126
138
 
127
- def pdf(format: nil, landscape: nil, print_background: nil)
139
+ def pdf(format: nil, landscape: nil, print_background: nil, scale: nil, margin: nil)
128
140
  params = {}
129
141
  params[:format] = format if format
130
142
  params[:landscape] = landscape unless landscape.nil?
131
143
  params[:print_background] = print_background unless print_background.nil?
144
+ params[:scale] = scale if scale
145
+ params[:margin] = margin if margin
132
146
  act([{ pdf: params }])
133
147
  end
134
148
 
135
- def execute_js(expression)
136
- act([{ execute_js: { expression: expression } }])
149
+ def execute_js(code, result_key: nil, timeout: nil)
150
+ params = { code: code }
151
+ params[:result_key] = result_key if result_key
152
+ params[:timeout] = timeout if timeout
153
+ act([{ execute_js: params }])
137
154
  end
138
155
 
139
156
  def close
@@ -1,3 +1,3 @@
1
1
  module Browserbeam
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browserbeam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Browserbeam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-24 00:00:00.000000000 Z
11
+ date: 2026-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday