summaryrefslogtreecommitdiff
path: root/vendor/github.com/playwright-community/playwright-go/cdp_session.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-14 13:18:54 -0600
committermo khan <mo@mokhan.ca>2025-05-14 13:18:54 -0600
commit4b2d609a0efcc1d9b2f1a08f954d067ad1d9cd1e (patch)
tree0afacf9217b0569130da6b97d4197331681bf119 /vendor/github.com/playwright-community/playwright-go/cdp_session.go
parentab373d1fe698cd3f53258c09bc8515d88a6d0b9e (diff)
test: use playwright to test out an OIDC login
Diffstat (limited to 'vendor/github.com/playwright-community/playwright-go/cdp_session.go')
-rw-r--r--vendor/github.com/playwright-community/playwright-go/cdp_session.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/github.com/playwright-community/playwright-go/cdp_session.go b/vendor/github.com/playwright-community/playwright-go/cdp_session.go
new file mode 100644
index 0000000..e9bba82
--- /dev/null
+++ b/vendor/github.com/playwright-community/playwright-go/cdp_session.go
@@ -0,0 +1,38 @@
+package playwright
+
+type cdpSessionImpl struct {
+ channelOwner
+}
+
+func (c *cdpSessionImpl) Detach() error {
+ _, err := c.channel.Send("detach")
+ return err
+}
+
+func (c *cdpSessionImpl) Send(method string, params map[string]interface{}) (interface{}, error) {
+ result, err := c.channel.Send("send", map[string]interface{}{
+ "method": method,
+ "params": params,
+ })
+ if err != nil {
+ return nil, err
+ }
+
+ return result, err
+}
+
+func (c *cdpSessionImpl) onEvent(params map[string]interface{}) {
+ c.Emit(params["method"].(string), params["params"])
+}
+
+func newCDPSession(parent *channelOwner, objectType string, guid string, initializer map[string]interface{}) *cdpSessionImpl {
+ bt := &cdpSessionImpl{}
+
+ bt.createChannelOwner(bt, parent, objectType, guid, initializer)
+
+ bt.channel.On("event", func(params map[string]interface{}) {
+ bt.onEvent(params)
+ })
+
+ return bt
+}