From 20d575fece73a6e8284d9fa8efc46fbaa848c96b Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Tue, 24 Jan 2017 22:09:23 +0700 Subject: [PATCH] Initial import --- .gitignore | 7 + LICENSE | 21 + README.md | 29 + actions.go | 49 + cdp/accessibility/accessibility.go | 111 + cdp/accessibility/easyjson.go | 1064 ++ cdp/accessibility/types.go | 559 + cdp/animation/animation.go | 577 + cdp/animation/easyjson.go | 1760 +++ cdp/animation/events.go | 49 + cdp/animation/types.go | 117 + cdp/applicationcache/applicationcache.go | 268 + cdp/applicationcache/easyjson.go | 1015 ++ cdp/applicationcache/events.go | 43 + cdp/applicationcache/types.go | 50 + cdp/cachestorage/cachestorage.go | 283 + cdp/cachestorage/easyjson.go | 707 ++ cdp/cachestorage/types.go | 48 + cdp/cdp.go | 1886 +++ cdp/css/css.go | 1460 +++ cdp/css/easyjson.go | 6665 ++++++++++ cdp/css/events.go | 62 + cdp/css/types.go | 366 + cdp/database/database.go | 251 + cdp/database/easyjson.go | 792 ++ cdp/database/events.go | 36 + cdp/database/types.go | 49 + cdp/debugger/debugger.go | 1499 +++ cdp/debugger/easyjson.go | 4086 ++++++ cdp/debugger/events.go | 91 + cdp/debugger/types.go | 259 + cdp/deviceorientation/deviceorientation.go | 132 + cdp/deviceorientation/easyjson.go | 161 + cdp/dom/dom.go | 2634 ++++ cdp/dom/easyjson.go | 6889 ++++++++++ cdp/dom/events.go | 146 + cdp/dom/types.go | 122 + cdp/domdebugger/domdebugger.go | 549 + cdp/domdebugger/easyjson.go | 963 ++ cdp/domdebugger/types.go | 92 + cdp/domstorage/domstorage.go | 338 + cdp/domstorage/easyjson.go | 1065 ++ cdp/domstorage/events.go | 57 + cdp/domstorage/types.go | 36 + cdp/easyjson.go | 1168 ++ cdp/emulation/easyjson.go | 1361 ++ cdp/emulation/emulation.go | 896 ++ cdp/emulation/events.go | 36 + cdp/emulation/types.go | 178 + cdp/heapprofiler/easyjson.go | 1589 +++ cdp/heapprofiler/events.go | 64 + cdp/heapprofiler/heapprofiler.go | 598 + cdp/heapprofiler/types.go | 49 + cdp/indexeddb/easyjson.go | 1694 +++ cdp/indexeddb/indexeddb.go | 399 + cdp/indexeddb/types.go | 180 + cdp/input/easyjson.go | 1125 ++ cdp/input/input.go | 726 ++ cdp/input/types.go | 400 + cdp/inspector/easyjson.go | 265 + cdp/inspector/events.go | 42 + cdp/inspector/inspector.go | 112 + cdp/inspector/types.go | 80 + cdp/io/easyjson.go | 252 + cdp/io/io.go | 173 + cdp/io/types.go | 34 + cdp/layertree/easyjson.go | 1902 +++ cdp/layertree/events.go | 43 + cdp/layertree/layertree.go | 614 + cdp/layertree/types.go | 130 + cdp/log/easyjson.go | 685 + cdp/log/events.go | 37 + cdp/log/log.go | 248 + cdp/log/types.go | 227 + cdp/memory/easyjson.go | 301 + cdp/memory/memory.go | 198 + cdp/memory/types.go | 74 + cdp/network/easyjson.go | 5698 +++++++++ cdp/network/events.go | 170 + cdp/network/network.go | 1378 ++ cdp/network/types.go | 538 + cdp/page/easyjson.go | 4829 +++++++ cdp/page/events.go | 147 + cdp/page/page.go | 1522 +++ cdp/page/types.go | 316 + cdp/profiler/easyjson.go | 1112 ++ cdp/profiler/events.go | 49 + cdp/profiler/profiler.go | 251 + cdp/profiler/types.go | 55 + cdp/rendering/easyjson.go | 354 + cdp/rendering/rendering.go | 300 + cdp/runtime/easyjson.go | 4121 ++++++ cdp/runtime/events.go | 81 + cdp/runtime/runtime.go | 1002 ++ cdp/runtime/types.go | 435 + cdp/schema/easyjson.go | 266 + cdp/schema/schema.go | 90 + cdp/schema/types.go | 33 + cdp/security/easyjson.go | 575 + cdp/security/events.go | 41 + cdp/security/security.go | 154 + cdp/security/types.go | 113 + cdp/serviceworker/easyjson.go | 1465 +++ cdp/serviceworker/events.go | 46 + cdp/serviceworker/serviceworker.go | 564 + cdp/serviceworker/types.go | 163 + cdp/storage/easyjson.go | 94 + cdp/storage/storage.go | 89 + cdp/storage/types.go | 98 + cdp/systeminfo/easyjson.go | 445 + cdp/systeminfo/systeminfo.go | 95 + cdp/systeminfo/types.go | 44 + cdp/target/easyjson.go | 2129 ++++ cdp/target/events.go | 66 + cdp/target/target.go | 885 ++ cdp/target/types.go | 53 + cdp/tethering/easyjson.go | 232 + cdp/tethering/events.go | 39 + cdp/tethering/tethering.go | 140 + cdp/tracing/easyjson.go | 1090 ++ cdp/tracing/events.go | 55 + cdp/tracing/tracing.go | 305 + cdp/tracing/types.go | 138 + cdp/util/util.go | 1265 ++ chromedp.go | 392 + client/chrome.go | 39 + client/client.go | 319 + client/easyjson.go | 148 + client/target.go | 65 + client/transport.go | 69 + cmd/chromedp-gen/README.md | 13 + cmd/chromedp-gen/build.sh | 10 + cmd/chromedp-gen/fixup/fixup.go | 563 + cmd/chromedp-gen/gen/gen.go | 167 + cmd/chromedp-gen/internal/enum.go | 326 + cmd/chromedp-gen/internal/flag.go | 36 + cmd/chromedp-gen/internal/types.go | 476 + cmd/chromedp-gen/internal/util.go | 190 + cmd/chromedp-gen/main.go | 251 + cmd/chromedp-gen/protocol.json | 12452 +++++++++++++++++++ cmd/chromedp-gen/templates/domain.qtpl | 163 + cmd/chromedp-gen/templates/domain.qtpl.go | 677 + cmd/chromedp-gen/templates/extra.qtpl | 251 + cmd/chromedp-gen/templates/extra.qtpl.go | 633 + cmd/chromedp-gen/templates/file.qtpl | 54 + cmd/chromedp-gen/templates/file.qtpl.go | 321 + cmd/chromedp-gen/templates/type.qtpl | 93 + cmd/chromedp-gen/templates/type.qtpl.go | 328 + cmd/chromedp-gen/templates/util.go | 48 + cmd/chromedp-gen/update.sh | 28 + contrib/start.sh | 10 + contrib/stats.sh | 16 + examples/click/.gitignore | 2 + examples/click/main.go | 50 + examples/edge-simple/.gitignore | 2 + examples/edge-simple/main.go | 64 + examples/keys/.gitignore | 2 + examples/keys/main.go | 61 + examples/screenshot/.gitignore | 3 + examples/screenshot/main.go | 58 + examples/simple/.gitignore | 3 + examples/simple/main.go | 70 + examples/submit/.gitignore | 2 + examples/submit/main.go | 52 + examples/text/.gitignore | 2 + examples/text/main.go | 50 + examples/visible/.gitignore | 2 + examples/visible/main.go | 78 + handler.go | 659 + input.go | 171 + nav.go | 164 + query.go | 499 + runner/path_darwin.go | 11 + runner/path_unix.go | 29 + runner/path_windows.go | 33 + runner/runner.go | 393 + runner/runner_bsd.go | 11 + runner/runner_linux.go | 87 + runner/runner_unix.go | 31 + runner/runner_windows.go | 42 + sel.go | 465 + testdata/visible.html | 22 + util.go | 262 + 183 files changed, 107971 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 actions.go create mode 100644 cdp/accessibility/accessibility.go create mode 100644 cdp/accessibility/easyjson.go create mode 100644 cdp/accessibility/types.go create mode 100644 cdp/animation/animation.go create mode 100644 cdp/animation/easyjson.go create mode 100644 cdp/animation/events.go create mode 100644 cdp/animation/types.go create mode 100644 cdp/applicationcache/applicationcache.go create mode 100644 cdp/applicationcache/easyjson.go create mode 100644 cdp/applicationcache/events.go create mode 100644 cdp/applicationcache/types.go create mode 100644 cdp/cachestorage/cachestorage.go create mode 100644 cdp/cachestorage/easyjson.go create mode 100644 cdp/cachestorage/types.go create mode 100644 cdp/cdp.go create mode 100644 cdp/css/css.go create mode 100644 cdp/css/easyjson.go create mode 100644 cdp/css/events.go create mode 100644 cdp/css/types.go create mode 100644 cdp/database/database.go create mode 100644 cdp/database/easyjson.go create mode 100644 cdp/database/events.go create mode 100644 cdp/database/types.go create mode 100644 cdp/debugger/debugger.go create mode 100644 cdp/debugger/easyjson.go create mode 100644 cdp/debugger/events.go create mode 100644 cdp/debugger/types.go create mode 100644 cdp/deviceorientation/deviceorientation.go create mode 100644 cdp/deviceorientation/easyjson.go create mode 100644 cdp/dom/dom.go create mode 100644 cdp/dom/easyjson.go create mode 100644 cdp/dom/events.go create mode 100644 cdp/dom/types.go create mode 100644 cdp/domdebugger/domdebugger.go create mode 100644 cdp/domdebugger/easyjson.go create mode 100644 cdp/domdebugger/types.go create mode 100644 cdp/domstorage/domstorage.go create mode 100644 cdp/domstorage/easyjson.go create mode 100644 cdp/domstorage/events.go create mode 100644 cdp/domstorage/types.go create mode 100644 cdp/easyjson.go create mode 100644 cdp/emulation/easyjson.go create mode 100644 cdp/emulation/emulation.go create mode 100644 cdp/emulation/events.go create mode 100644 cdp/emulation/types.go create mode 100644 cdp/heapprofiler/easyjson.go create mode 100644 cdp/heapprofiler/events.go create mode 100644 cdp/heapprofiler/heapprofiler.go create mode 100644 cdp/heapprofiler/types.go create mode 100644 cdp/indexeddb/easyjson.go create mode 100644 cdp/indexeddb/indexeddb.go create mode 100644 cdp/indexeddb/types.go create mode 100644 cdp/input/easyjson.go create mode 100644 cdp/input/input.go create mode 100644 cdp/input/types.go create mode 100644 cdp/inspector/easyjson.go create mode 100644 cdp/inspector/events.go create mode 100644 cdp/inspector/inspector.go create mode 100644 cdp/inspector/types.go create mode 100644 cdp/io/easyjson.go create mode 100644 cdp/io/io.go create mode 100644 cdp/io/types.go create mode 100644 cdp/layertree/easyjson.go create mode 100644 cdp/layertree/events.go create mode 100644 cdp/layertree/layertree.go create mode 100644 cdp/layertree/types.go create mode 100644 cdp/log/easyjson.go create mode 100644 cdp/log/events.go create mode 100644 cdp/log/log.go create mode 100644 cdp/log/types.go create mode 100644 cdp/memory/easyjson.go create mode 100644 cdp/memory/memory.go create mode 100644 cdp/memory/types.go create mode 100644 cdp/network/easyjson.go create mode 100644 cdp/network/events.go create mode 100644 cdp/network/network.go create mode 100644 cdp/network/types.go create mode 100644 cdp/page/easyjson.go create mode 100644 cdp/page/events.go create mode 100644 cdp/page/page.go create mode 100644 cdp/page/types.go create mode 100644 cdp/profiler/easyjson.go create mode 100644 cdp/profiler/events.go create mode 100644 cdp/profiler/profiler.go create mode 100644 cdp/profiler/types.go create mode 100644 cdp/rendering/easyjson.go create mode 100644 cdp/rendering/rendering.go create mode 100644 cdp/runtime/easyjson.go create mode 100644 cdp/runtime/events.go create mode 100644 cdp/runtime/runtime.go create mode 100644 cdp/runtime/types.go create mode 100644 cdp/schema/easyjson.go create mode 100644 cdp/schema/schema.go create mode 100644 cdp/schema/types.go create mode 100644 cdp/security/easyjson.go create mode 100644 cdp/security/events.go create mode 100644 cdp/security/security.go create mode 100644 cdp/security/types.go create mode 100644 cdp/serviceworker/easyjson.go create mode 100644 cdp/serviceworker/events.go create mode 100644 cdp/serviceworker/serviceworker.go create mode 100644 cdp/serviceworker/types.go create mode 100644 cdp/storage/easyjson.go create mode 100644 cdp/storage/storage.go create mode 100644 cdp/storage/types.go create mode 100644 cdp/systeminfo/easyjson.go create mode 100644 cdp/systeminfo/systeminfo.go create mode 100644 cdp/systeminfo/types.go create mode 100644 cdp/target/easyjson.go create mode 100644 cdp/target/events.go create mode 100644 cdp/target/target.go create mode 100644 cdp/target/types.go create mode 100644 cdp/tethering/easyjson.go create mode 100644 cdp/tethering/events.go create mode 100644 cdp/tethering/tethering.go create mode 100644 cdp/tracing/easyjson.go create mode 100644 cdp/tracing/events.go create mode 100644 cdp/tracing/tracing.go create mode 100644 cdp/tracing/types.go create mode 100644 cdp/util/util.go create mode 100644 chromedp.go create mode 100644 client/chrome.go create mode 100644 client/client.go create mode 100644 client/easyjson.go create mode 100644 client/target.go create mode 100644 client/transport.go create mode 100644 cmd/chromedp-gen/README.md create mode 100755 cmd/chromedp-gen/build.sh create mode 100644 cmd/chromedp-gen/fixup/fixup.go create mode 100644 cmd/chromedp-gen/gen/gen.go create mode 100644 cmd/chromedp-gen/internal/enum.go create mode 100644 cmd/chromedp-gen/internal/flag.go create mode 100644 cmd/chromedp-gen/internal/types.go create mode 100644 cmd/chromedp-gen/internal/util.go create mode 100644 cmd/chromedp-gen/main.go create mode 100644 cmd/chromedp-gen/protocol.json create mode 100644 cmd/chromedp-gen/templates/domain.qtpl create mode 100644 cmd/chromedp-gen/templates/domain.qtpl.go create mode 100644 cmd/chromedp-gen/templates/extra.qtpl create mode 100644 cmd/chromedp-gen/templates/extra.qtpl.go create mode 100644 cmd/chromedp-gen/templates/file.qtpl create mode 100644 cmd/chromedp-gen/templates/file.qtpl.go create mode 100644 cmd/chromedp-gen/templates/type.qtpl create mode 100644 cmd/chromedp-gen/templates/type.qtpl.go create mode 100644 cmd/chromedp-gen/templates/util.go create mode 100755 cmd/chromedp-gen/update.sh create mode 100755 contrib/start.sh create mode 100755 contrib/stats.sh create mode 100644 examples/click/.gitignore create mode 100644 examples/click/main.go create mode 100644 examples/edge-simple/.gitignore create mode 100644 examples/edge-simple/main.go create mode 100644 examples/keys/.gitignore create mode 100644 examples/keys/main.go create mode 100644 examples/screenshot/.gitignore create mode 100644 examples/screenshot/main.go create mode 100644 examples/simple/.gitignore create mode 100644 examples/simple/main.go create mode 100644 examples/submit/.gitignore create mode 100644 examples/submit/main.go create mode 100644 examples/text/.gitignore create mode 100644 examples/text/main.go create mode 100644 examples/visible/.gitignore create mode 100644 examples/visible/main.go create mode 100644 handler.go create mode 100644 input.go create mode 100644 nav.go create mode 100644 query.go create mode 100644 runner/path_darwin.go create mode 100644 runner/path_unix.go create mode 100644 runner/path_windows.go create mode 100644 runner/runner.go create mode 100644 runner/runner_bsd.go create mode 100644 runner/runner_linux.go create mode 100644 runner/runner_unix.go create mode 100644 runner/runner_windows.go create mode 100644 sel.go create mode 100644 testdata/visible.html create mode 100644 util.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f2ddf74 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +out.txt +out*.txt +old*.txt + +# binaries +/chromedp-gen +/cmd/chromedp-gen/chromedp-gen diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8e2e6c2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016-2017 Kenneth Shaw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e45a6f0 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# About chromedp + +Package chromedp is a faster, simpler way to drive browsers in Go using the +[Chrome Debugging Protocol](https://developer.chrome.com/devtools/docs/debugger-protocol) +(for Chrome, Edge, Safari, etc) without external dependencies (ie, Selenium, PhantomJS, etc). + +**NOTE:** chromedp's API is currently unstable, and may change at a moments +notice. There are likely extremely bad bugs lurking in this code. **CAVEAT USER**. + +## Installation + +Install in the usual way: + +```sh +go get -u github.com/knq/chromedp +``` + +## Usage + +Please see the [examples](examples/) directory for examples. + +## TODO +* Move timeouts to context (defaults) +* Implement more query selector options (allow over riding context timeouts) +* Contextual actions for "dry run" (or via an accumulator?) +* Network loader / manager +* More examples +* Profiler +* Unit tests / coverage: travis-ci + coveralls integration diff --git a/actions.go b/actions.go new file mode 100644 index 0000000..fae2721 --- /dev/null +++ b/actions.go @@ -0,0 +1,49 @@ +package chromedp + +import ( + "context" + "time" + + . "github.com/knq/chromedp/cdp" +) + +// Action is a single atomic action. +type Action interface { + Do(context.Context, FrameHandler) error +} + +// ActionFunc is a single action func. +type ActionFunc func(context.Context, FrameHandler) error + +// Do executes the action using the provided context. +func (f ActionFunc) Do(ctxt context.Context, h FrameHandler) error { + return f(ctxt, h) +} + +// Tasks is a list of Actions that can be used as a single Action. +type Tasks []Action + +// Do executes the list of Tasks using the provided context. +func (t Tasks) Do(ctxt context.Context, h FrameHandler) error { + var err error + + // TODO: put individual task timeouts from context here + for _, a := range t { + // ctxt, cancel = context.WithTimeout(ctxt, timeout) + // defer cancel() + err = a.Do(ctxt, h) + if err != nil { + return err + } + } + + return nil +} + +// Sleep is an empty action that calls time.Sleep with the specified duration. +func Sleep(d time.Duration) Action { + return ActionFunc(func(context.Context, FrameHandler) error { + time.Sleep(d) + return nil + }) +} diff --git a/cdp/accessibility/accessibility.go b/cdp/accessibility/accessibility.go new file mode 100644 index 0000000..ea04fe3 --- /dev/null +++ b/cdp/accessibility/accessibility.go @@ -0,0 +1,111 @@ +// Package accessibility provides the Chrome Debugging Protocol +// commands, types, and events for the Chrome Accessibility domain. +// +// Generated by the chromedp-gen command. +package accessibility + +// AUTOGENERATED. DO NOT EDIT. + +import ( + "context" + + . "github.com/knq/chromedp/cdp" + "github.com/mailru/easyjson" +) + +var ( + _ BackendNode + _ BackendNodeID + _ ComputedProperty + _ ErrorType + _ Frame + _ FrameID + _ LoaderID + _ Message + _ MessageError + _ MethodType + _ Node + _ NodeID + _ NodeType + _ PseudoType + _ RGBA + _ ShadowRootType + _ Timestamp +) + +// GetPartialAXTreeParams fetches the accessibility node and partial +// accessibility tree for this DOM node, if it exists. +type GetPartialAXTreeParams struct { + NodeID NodeID `json:"nodeId"` // ID of node to get the partial accessibility tree for. + FetchRelatives bool `json:"fetchRelatives,omitempty"` // Whether to fetch this nodes ancestors, siblings and children. Defaults to true. +} + +// GetPartialAXTree fetches the accessibility node and partial accessibility +// tree for this DOM node, if it exists. +// +// parameters: +// nodeId - ID of node to get the partial accessibility tree for. +func GetPartialAXTree(nodeId NodeID) *GetPartialAXTreeParams { + return &GetPartialAXTreeParams{ + NodeID: nodeId, + } +} + +// WithFetchRelatives whether to fetch this nodes ancestors, siblings and +// children. Defaults to true. +func (p GetPartialAXTreeParams) WithFetchRelatives(fetchRelatives bool) *GetPartialAXTreeParams { + p.FetchRelatives = fetchRelatives + return &p +} + +// GetPartialAXTreeReturns return values. +type GetPartialAXTreeReturns struct { + Nodes []*AXNode `json:"nodes,omitempty"` // The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested. +} + +// Do executes Accessibility.getPartialAXTree. +// +// returns: +// nodes - The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested. +func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h FrameHandler) (nodes []*AXNode, err error) { + if ctxt == nil { + ctxt = context.Background() + } + + // marshal + buf, err := easyjson.Marshal(p) + if err != nil { + return nil, err + } + + // execute + ch := h.Execute(ctxt, CommandAccessibilityGetPartialAXTree, easyjson.RawMessage(buf)) + + // read response + select { + case res := <-ch: + if res == nil { + return nil, ErrChannelClosed + } + + switch v := res.(type) { + case easyjson.RawMessage: + // unmarshal + var r GetPartialAXTreeReturns + err = easyjson.Unmarshal(v, &r) + if err != nil { + return nil, ErrInvalidResult + } + + return r.Nodes, nil + + case error: + return nil, v + } + + case <-ctxt.Done(): + return nil, ErrContextDone + } + + return nil, ErrUnknownResult +} diff --git a/cdp/accessibility/easyjson.go b/cdp/accessibility/easyjson.go new file mode 100644 index 0000000..c43654a --- /dev/null +++ b/cdp/accessibility/easyjson.go @@ -0,0 +1,1064 @@ +// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. + +package accessibility + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility(in *jlexer.Lexer, out *GetPartialAXTreeReturns) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "nodes": + if in.IsNull() { + in.Skip() + out.Nodes = nil + } else { + in.Delim('[') + if !in.IsDelim(']') { + out.Nodes = make([]*AXNode, 0, 8) + } else { + out.Nodes = []*AXNode{} + } + for !in.IsDelim(']') { + var v1 *AXNode + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(AXNode) + } + (*v1).UnmarshalEasyJSON(in) + } + out.Nodes = append(out.Nodes, v1) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility(out *jwriter.Writer, in GetPartialAXTreeReturns) { + out.RawByte('{') + first := true + _ = first + if len(in.Nodes) != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"nodes\":") + if in.Nodes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.Nodes { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + (*v3).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v GetPartialAXTreeReturns) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v GetPartialAXTreeReturns) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *GetPartialAXTreeReturns) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *GetPartialAXTreeReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility1(in *jlexer.Lexer, out *GetPartialAXTreeParams) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "nodeId": + (out.NodeID).UnmarshalEasyJSON(in) + case "fetchRelatives": + out.FetchRelatives = bool(in.Bool()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility1(out *jwriter.Writer, in GetPartialAXTreeParams) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"nodeId\":") + out.Int64(int64(in.NodeID)) + if in.FetchRelatives { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"fetchRelatives\":") + out.Bool(bool(in.FetchRelatives)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v GetPartialAXTreeParams) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility1(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v GetPartialAXTreeParams) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility1(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *GetPartialAXTreeParams) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility1(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *GetPartialAXTreeParams) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility1(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility2(in *jlexer.Lexer, out *AXValueSource) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "type": + (out.Type).UnmarshalEasyJSON(in) + case "value": + if in.IsNull() { + in.Skip() + out.Value = nil + } else { + if out.Value == nil { + out.Value = new(AXValue) + } + (*out.Value).UnmarshalEasyJSON(in) + } + case "attribute": + out.Attribute = string(in.String()) + case "attributeValue": + if in.IsNull() { + in.Skip() + out.AttributeValue = nil + } else { + if out.AttributeValue == nil { + out.AttributeValue = new(AXValue) + } + (*out.AttributeValue).UnmarshalEasyJSON(in) + } + case "superseded": + out.Superseded = bool(in.Bool()) + case "nativeSource": + (out.NativeSource).UnmarshalEasyJSON(in) + case "nativeSourceValue": + if in.IsNull() { + in.Skip() + out.NativeSourceValue = nil + } else { + if out.NativeSourceValue == nil { + out.NativeSourceValue = new(AXValue) + } + (*out.NativeSourceValue).UnmarshalEasyJSON(in) + } + case "invalid": + out.Invalid = bool(in.Bool()) + case "invalidReason": + out.InvalidReason = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility2(out *jwriter.Writer, in AXValueSource) { + out.RawByte('{') + first := true + _ = first + if in.Type != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) + } + if in.Value != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + if in.Value == nil { + out.RawString("null") + } else { + (*in.Value).MarshalEasyJSON(out) + } + } + if in.Attribute != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"attribute\":") + out.String(string(in.Attribute)) + } + if in.AttributeValue != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"attributeValue\":") + if in.AttributeValue == nil { + out.RawString("null") + } else { + (*in.AttributeValue).MarshalEasyJSON(out) + } + } + if in.Superseded { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"superseded\":") + out.Bool(bool(in.Superseded)) + } + if in.NativeSource != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"nativeSource\":") + (in.NativeSource).MarshalEasyJSON(out) + } + if in.NativeSourceValue != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"nativeSourceValue\":") + if in.NativeSourceValue == nil { + out.RawString("null") + } else { + (*in.NativeSourceValue).MarshalEasyJSON(out) + } + } + if in.Invalid { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"invalid\":") + out.Bool(bool(in.Invalid)) + } + if in.InvalidReason != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"invalidReason\":") + out.String(string(in.InvalidReason)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v AXValueSource) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility2(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v AXValueSource) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility2(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *AXValueSource) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility2(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *AXValueSource) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility2(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility3(in *jlexer.Lexer, out *AXValue) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "type": + (out.Type).UnmarshalEasyJSON(in) + case "value": + (out.Value).UnmarshalEasyJSON(in) + case "relatedNodes": + if in.IsNull() { + in.Skip() + out.RelatedNodes = nil + } else { + in.Delim('[') + if !in.IsDelim(']') { + out.RelatedNodes = make([]*AXRelatedNode, 0, 8) + } else { + out.RelatedNodes = []*AXRelatedNode{} + } + for !in.IsDelim(']') { + var v4 *AXRelatedNode + if in.IsNull() { + in.Skip() + v4 = nil + } else { + if v4 == nil { + v4 = new(AXRelatedNode) + } + (*v4).UnmarshalEasyJSON(in) + } + out.RelatedNodes = append(out.RelatedNodes, v4) + in.WantComma() + } + in.Delim(']') + } + case "sources": + if in.IsNull() { + in.Skip() + out.Sources = nil + } else { + in.Delim('[') + if !in.IsDelim(']') { + out.Sources = make([]*AXValueSource, 0, 8) + } else { + out.Sources = []*AXValueSource{} + } + for !in.IsDelim(']') { + var v5 *AXValueSource + if in.IsNull() { + in.Skip() + v5 = nil + } else { + if v5 == nil { + v5 = new(AXValueSource) + } + (*v5).UnmarshalEasyJSON(in) + } + out.Sources = append(out.Sources, v5) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility3(out *jwriter.Writer, in AXValue) { + out.RawByte('{') + first := true + _ = first + if in.Type != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) + } + if (in.Value).IsDefined() { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + (in.Value).MarshalEasyJSON(out) + } + if len(in.RelatedNodes) != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"relatedNodes\":") + if in.RelatedNodes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v6, v7 := range in.RelatedNodes { + if v6 > 0 { + out.RawByte(',') + } + if v7 == nil { + out.RawString("null") + } else { + (*v7).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + if len(in.Sources) != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"sources\":") + if in.Sources == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v8, v9 := range in.Sources { + if v8 > 0 { + out.RawByte(',') + } + if v9 == nil { + out.RawString("null") + } else { + (*v9).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v AXValue) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility3(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v AXValue) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility3(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *AXValue) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility3(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *AXValue) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility3(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility4(in *jlexer.Lexer, out *AXRelatedNode) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "backendDOMNodeId": + (out.BackendDOMNodeID).UnmarshalEasyJSON(in) + case "idref": + out.Idref = string(in.String()) + case "text": + out.Text = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility4(out *jwriter.Writer, in AXRelatedNode) { + out.RawByte('{') + first := true + _ = first + if in.BackendDOMNodeID != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"backendDOMNodeId\":") + out.Int64(int64(in.BackendDOMNodeID)) + } + if in.Idref != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"idref\":") + out.String(string(in.Idref)) + } + if in.Text != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"text\":") + out.String(string(in.Text)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v AXRelatedNode) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility4(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v AXRelatedNode) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility4(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *AXRelatedNode) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility4(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *AXRelatedNode) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility4(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility5(in *jlexer.Lexer, out *AXProperty) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "name": + out.Name = string(in.String()) + case "value": + if in.IsNull() { + in.Skip() + out.Value = nil + } else { + if out.Value == nil { + out.Value = new(AXValue) + } + (*out.Value).UnmarshalEasyJSON(in) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility5(out *jwriter.Writer, in AXProperty) { + out.RawByte('{') + first := true + _ = first + if in.Name != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + } + if in.Value != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + if in.Value == nil { + out.RawString("null") + } else { + (*in.Value).MarshalEasyJSON(out) + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v AXProperty) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility5(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v AXProperty) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility5(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *AXProperty) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility5(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *AXProperty) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility5(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility6(in *jlexer.Lexer, out *AXNode) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "nodeId": + out.NodeID = AXNodeID(in.String()) + case "ignored": + out.Ignored = bool(in.Bool()) + case "ignoredReasons": + if in.IsNull() { + in.Skip() + out.IgnoredReasons = nil + } else { + in.Delim('[') + if !in.IsDelim(']') { + out.IgnoredReasons = make([]*AXProperty, 0, 8) + } else { + out.IgnoredReasons = []*AXProperty{} + } + for !in.IsDelim(']') { + var v10 *AXProperty + if in.IsNull() { + in.Skip() + v10 = nil + } else { + if v10 == nil { + v10 = new(AXProperty) + } + (*v10).UnmarshalEasyJSON(in) + } + out.IgnoredReasons = append(out.IgnoredReasons, v10) + in.WantComma() + } + in.Delim(']') + } + case "role": + if in.IsNull() { + in.Skip() + out.Role = nil + } else { + if out.Role == nil { + out.Role = new(AXValue) + } + (*out.Role).UnmarshalEasyJSON(in) + } + case "name": + if in.IsNull() { + in.Skip() + out.Name = nil + } else { + if out.Name == nil { + out.Name = new(AXValue) + } + (*out.Name).UnmarshalEasyJSON(in) + } + case "description": + if in.IsNull() { + in.Skip() + out.Description = nil + } else { + if out.Description == nil { + out.Description = new(AXValue) + } + (*out.Description).UnmarshalEasyJSON(in) + } + case "value": + if in.IsNull() { + in.Skip() + out.Value = nil + } else { + if out.Value == nil { + out.Value = new(AXValue) + } + (*out.Value).UnmarshalEasyJSON(in) + } + case "properties": + if in.IsNull() { + in.Skip() + out.Properties = nil + } else { + in.Delim('[') + if !in.IsDelim(']') { + out.Properties = make([]*AXProperty, 0, 8) + } else { + out.Properties = []*AXProperty{} + } + for !in.IsDelim(']') { + var v11 *AXProperty + if in.IsNull() { + in.Skip() + v11 = nil + } else { + if v11 == nil { + v11 = new(AXProperty) + } + (*v11).UnmarshalEasyJSON(in) + } + out.Properties = append(out.Properties, v11) + in.WantComma() + } + in.Delim(']') + } + case "childIds": + if in.IsNull() { + in.Skip() + out.ChildIds = nil + } else { + in.Delim('[') + if !in.IsDelim(']') { + out.ChildIds = make([]AXNodeID, 0, 4) + } else { + out.ChildIds = []AXNodeID{} + } + for !in.IsDelim(']') { + var v12 AXNodeID + v12 = AXNodeID(in.String()) + out.ChildIds = append(out.ChildIds, v12) + in.WantComma() + } + in.Delim(']') + } + case "backendDOMNodeId": + (out.BackendDOMNodeID).UnmarshalEasyJSON(in) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility6(out *jwriter.Writer, in AXNode) { + out.RawByte('{') + first := true + _ = first + if in.NodeID != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"nodeId\":") + out.String(string(in.NodeID)) + } + if in.Ignored { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"ignored\":") + out.Bool(bool(in.Ignored)) + } + if len(in.IgnoredReasons) != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"ignoredReasons\":") + if in.IgnoredReasons == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v13, v14 := range in.IgnoredReasons { + if v13 > 0 { + out.RawByte(',') + } + if v14 == nil { + out.RawString("null") + } else { + (*v14).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + if in.Role != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"role\":") + if in.Role == nil { + out.RawString("null") + } else { + (*in.Role).MarshalEasyJSON(out) + } + } + if in.Name != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"name\":") + if in.Name == nil { + out.RawString("null") + } else { + (*in.Name).MarshalEasyJSON(out) + } + } + if in.Description != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"description\":") + if in.Description == nil { + out.RawString("null") + } else { + (*in.Description).MarshalEasyJSON(out) + } + } + if in.Value != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + if in.Value == nil { + out.RawString("null") + } else { + (*in.Value).MarshalEasyJSON(out) + } + } + if len(in.Properties) != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"properties\":") + if in.Properties == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v15, v16 := range in.Properties { + if v15 > 0 { + out.RawByte(',') + } + if v16 == nil { + out.RawString("null") + } else { + (*v16).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + if len(in.ChildIds) != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"childIds\":") + if in.ChildIds == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v17, v18 := range in.ChildIds { + if v17 > 0 { + out.RawByte(',') + } + out.String(string(v18)) + } + out.RawByte(']') + } + } + if in.BackendDOMNodeID != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"backendDOMNodeId\":") + out.Int64(int64(in.BackendDOMNodeID)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v AXNode) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility6(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v AXNode) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility6(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *AXNode) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility6(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *AXNode) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAccessibility6(l, v) +} diff --git a/cdp/accessibility/types.go b/cdp/accessibility/types.go new file mode 100644 index 0000000..471e14b --- /dev/null +++ b/cdp/accessibility/types.go @@ -0,0 +1,559 @@ +package accessibility + +// AUTOGENERATED. DO NOT EDIT. + +import ( + "errors" + + . "github.com/knq/chromedp/cdp" + "github.com/mailru/easyjson" + "github.com/mailru/easyjson/jlexer" + "github.com/mailru/easyjson/jwriter" +) + +var ( + _ BackendNode + _ BackendNodeID + _ ComputedProperty + _ ErrorType + _ Frame + _ FrameID + _ LoaderID + _ Message + _ MessageError + _ MethodType + _ Node + _ NodeID + _ NodeType + _ PseudoType + _ RGBA + _ ShadowRootType + _ Timestamp +) + +// AXNodeID unique accessibility node identifier. +type AXNodeID string + +// String returns the AXNodeID as string value. +func (t AXNodeID) String() string { + return string(t) +} + +// AXValueType enum of possible property types. +type AXValueType string + +// String returns the AXValueType as string value. +func (t AXValueType) String() string { + return string(t) +} + +// AXValueType values. +const ( + AXValueTypeBoolean AXValueType = "boolean" + AXValueTypeTristate AXValueType = "tristate" + AXValueTypeBooleanOrUndefined AXValueType = "booleanOrUndefined" + AXValueTypeIdref AXValueType = "idref" + AXValueTypeIdrefList AXValueType = "idrefList" + AXValueTypeInteger AXValueType = "integer" + AXValueTypeNode AXValueType = "node" + AXValueTypeNodeList AXValueType = "nodeList" + AXValueTypeNumber AXValueType = "number" + AXValueTypeString AXValueType = "string" + AXValueTypeComputedString AXValueType = "computedString" + AXValueTypeToken AXValueType = "token" + AXValueTypeTokenList AXValueType = "tokenList" + AXValueTypeDomRelation AXValueType = "domRelation" + AXValueTypeRole AXValueType = "role" + AXValueTypeInternalRole AXValueType = "internalRole" + AXValueTypeValueUndefined AXValueType = "valueUndefined" +) + +// MarshalEasyJSON satisfies easyjson.Marshaler. +func (t AXValueType) MarshalEasyJSON(out *jwriter.Writer) { + out.String(string(t)) +} + +// MarshalJSON satisfies json.Marshaler. +func (t AXValueType) MarshalJSON() ([]byte, error) { + return easyjson.Marshal(t) +} + +// UnmarshalEasyJSON satisfies easyjson.Unmarshaler. +func (t *AXValueType) UnmarshalEasyJSON(in *jlexer.Lexer) { + switch AXValueType(in.String()) { + case AXValueTypeBoolean: + *t = AXValueTypeBoolean + case AXValueTypeTristate: + *t = AXValueTypeTristate + case AXValueTypeBooleanOrUndefined: + *t = AXValueTypeBooleanOrUndefined + case AXValueTypeIdref: + *t = AXValueTypeIdref + case AXValueTypeIdrefList: + *t = AXValueTypeIdrefList + case AXValueTypeInteger: + *t = AXValueTypeInteger + case AXValueTypeNode: + *t = AXValueTypeNode + case AXValueTypeNodeList: + *t = AXValueTypeNodeList + case AXValueTypeNumber: + *t = AXValueTypeNumber + case AXValueTypeString: + *t = AXValueTypeString + case AXValueTypeComputedString: + *t = AXValueTypeComputedString + case AXValueTypeToken: + *t = AXValueTypeToken + case AXValueTypeTokenList: + *t = AXValueTypeTokenList + case AXValueTypeDomRelation: + *t = AXValueTypeDomRelation + case AXValueTypeRole: + *t = AXValueTypeRole + case AXValueTypeInternalRole: + *t = AXValueTypeInternalRole + case AXValueTypeValueUndefined: + *t = AXValueTypeValueUndefined + + default: + in.AddError(errors.New("unknown AXValueType value")) + } +} + +// UnmarshalJSON satisfies json.Unmarshaler. +func (t *AXValueType) UnmarshalJSON(buf []byte) error { + return easyjson.Unmarshal(buf, t) +} + +// AXValueSourceType enum of possible property sources. +type AXValueSourceType string + +// String returns the AXValueSourceType as string value. +func (t AXValueSourceType) String() string { + return string(t) +} + +// AXValueSourceType values. +const ( + AXValueSourceTypeAttribute AXValueSourceType = "attribute" + AXValueSourceTypeImplicit AXValueSourceType = "implicit" + AXValueSourceTypeStyle AXValueSourceType = "style" + AXValueSourceTypeContents AXValueSourceType = "contents" + AXValueSourceTypePlaceholder AXValueSourceType = "placeholder" + AXValueSourceTypeRelatedElement AXValueSourceType = "relatedElement" +) + +// MarshalEasyJSON satisfies easyjson.Marshaler. +func (t AXValueSourceType) MarshalEasyJSON(out *jwriter.Writer) { + out.String(string(t)) +} + +// MarshalJSON satisfies json.Marshaler. +func (t AXValueSourceType) MarshalJSON() ([]byte, error) { + return easyjson.Marshal(t) +} + +// UnmarshalEasyJSON satisfies easyjson.Unmarshaler. +func (t *AXValueSourceType) UnmarshalEasyJSON(in *jlexer.Lexer) { + switch AXValueSourceType(in.String()) { + case AXValueSourceTypeAttribute: + *t = AXValueSourceTypeAttribute + case AXValueSourceTypeImplicit: + *t = AXValueSourceTypeImplicit + case AXValueSourceTypeStyle: + *t = AXValueSourceTypeStyle + case AXValueSourceTypeContents: + *t = AXValueSourceTypeContents + case AXValueSourceTypePlaceholder: + *t = AXValueSourceTypePlaceholder + case AXValueSourceTypeRelatedElement: + *t = AXValueSourceTypeRelatedElement + + default: + in.AddError(errors.New("unknown AXValueSourceType value")) + } +} + +// UnmarshalJSON satisfies json.Unmarshaler. +func (t *AXValueSourceType) UnmarshalJSON(buf []byte) error { + return easyjson.Unmarshal(buf, t) +} + +// AXValueNativeSourceType enum of possible native property sources (as a +// subtype of a particular AXValueSourceType). +type AXValueNativeSourceType string + +// String returns the AXValueNativeSourceType as string value. +func (t AXValueNativeSourceType) String() string { + return string(t) +} + +// AXValueNativeSourceType values. +const ( + AXValueNativeSourceTypeFigcaption AXValueNativeSourceType = "figcaption" + AXValueNativeSourceTypeLabel AXValueNativeSourceType = "label" + AXValueNativeSourceTypeLabelfor AXValueNativeSourceType = "labelfor" + AXValueNativeSourceTypeLabelwrapped AXValueNativeSourceType = "labelwrapped" + AXValueNativeSourceTypeLegend AXValueNativeSourceType = "legend" + AXValueNativeSourceTypeTablecaption AXValueNativeSourceType = "tablecaption" + AXValueNativeSourceTypeTitle AXValueNativeSourceType = "title" + AXValueNativeSourceTypeOther AXValueNativeSourceType = "other" +) + +// MarshalEasyJSON satisfies easyjson.Marshaler. +func (t AXValueNativeSourceType) MarshalEasyJSON(out *jwriter.Writer) { + out.String(string(t)) +} + +// MarshalJSON satisfies json.Marshaler. +func (t AXValueNativeSourceType) MarshalJSON() ([]byte, error) { + return easyjson.Marshal(t) +} + +// UnmarshalEasyJSON satisfies easyjson.Unmarshaler. +func (t *AXValueNativeSourceType) UnmarshalEasyJSON(in *jlexer.Lexer) { + switch AXValueNativeSourceType(in.String()) { + case AXValueNativeSourceTypeFigcaption: + *t = AXValueNativeSourceTypeFigcaption + case AXValueNativeSourceTypeLabel: + *t = AXValueNativeSourceTypeLabel + case AXValueNativeSourceTypeLabelfor: + *t = AXValueNativeSourceTypeLabelfor + case AXValueNativeSourceTypeLabelwrapped: + *t = AXValueNativeSourceTypeLabelwrapped + case AXValueNativeSourceTypeLegend: + *t = AXValueNativeSourceTypeLegend + case AXValueNativeSourceTypeTablecaption: + *t = AXValueNativeSourceTypeTablecaption + case AXValueNativeSourceTypeTitle: + *t = AXValueNativeSourceTypeTitle + case AXValueNativeSourceTypeOther: + *t = AXValueNativeSourceTypeOther + + default: + in.AddError(errors.New("unknown AXValueNativeSourceType value")) + } +} + +// UnmarshalJSON satisfies json.Unmarshaler. +func (t *AXValueNativeSourceType) UnmarshalJSON(buf []byte) error { + return easyjson.Unmarshal(buf, t) +} + +// AXValueSource a single source for a computed AX property. +type AXValueSource struct { + Type AXValueSourceType `json:"type,omitempty"` // What type of source this is. + Value *AXValue `json:"value,omitempty"` // The value of this property source. + Attribute string `json:"attribute,omitempty"` // The name of the relevant attribute, if any. + AttributeValue *AXValue `json:"attributeValue,omitempty"` // The value of the relevant attribute, if any. + Superseded bool `json:"superseded,omitempty"` // Whether this source is superseded by a higher priority source. + NativeSource AXValueNativeSourceType `json:"nativeSource,omitempty"` // The native markup source for this value, e.g. a