Update chromedp to fix console errors (#1521)

This commit is contained in:
peolic
2021-06-23 01:05:58 +03:00
committed by GitHub
parent ae3400a9b1
commit be2fe1de26
526 changed files with 55061 additions and 30300 deletions

View File

@@ -114,16 +114,28 @@ func (p *GetPartialAXTreeParams) Do(ctx context.Context) (nodes []*Node, err err
return res.Nodes, nil
}
// GetFullAXTreeParams fetches the entire accessibility tree.
type GetFullAXTreeParams struct{}
// GetFullAXTreeParams fetches the entire accessibility tree for the root
// Document.
type GetFullAXTreeParams struct {
MaxDepth int64 `json:"max_depth,omitempty"` // The maximum depth at which descendants of the root node should be retrieved. If omitted, the full tree is returned.
}
// GetFullAXTree fetches the entire accessibility tree.
// GetFullAXTree fetches the entire accessibility tree for the root Document.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#method-getFullAXTree
//
// parameters:
func GetFullAXTree() *GetFullAXTreeParams {
return &GetFullAXTreeParams{}
}
// WithMaxDepth the maximum depth at which descendants of the root node
// should be retrieved. If omitted, the full tree is returned.
func (p GetFullAXTreeParams) WithMaxDepth(maxDepth int64) *GetFullAXTreeParams {
p.MaxDepth = maxDepth
return &p
}
// GetFullAXTreeReturns return values.
type GetFullAXTreeReturns struct {
Nodes []*Node `json:"nodes,omitempty"`
@@ -136,7 +148,127 @@ type GetFullAXTreeReturns struct {
func (p *GetFullAXTreeParams) Do(ctx context.Context) (nodes []*Node, err error) {
// execute
var res GetFullAXTreeReturns
err = cdp.Execute(ctx, CommandGetFullAXTree, nil, &res)
err = cdp.Execute(ctx, CommandGetFullAXTree, p, &res)
if err != nil {
return nil, err
}
return res.Nodes, nil
}
// GetChildAXNodesParams fetches a particular accessibility node by AXNodeId.
// Requires enable() to have been called previously.
type GetChildAXNodesParams struct {
ID NodeID `json:"id"`
}
// GetChildAXNodes fetches a particular accessibility node by AXNodeId.
// Requires enable() to have been called previously.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#method-getChildAXNodes
//
// parameters:
// id
func GetChildAXNodes(id NodeID) *GetChildAXNodesParams {
return &GetChildAXNodesParams{
ID: id,
}
}
// GetChildAXNodesReturns return values.
type GetChildAXNodesReturns struct {
Nodes []*Node `json:"nodes,omitempty"`
}
// Do executes Accessibility.getChildAXNodes against the provided context.
//
// returns:
// nodes
func (p *GetChildAXNodesParams) Do(ctx context.Context) (nodes []*Node, err error) {
// execute
var res GetChildAXNodesReturns
err = cdp.Execute(ctx, CommandGetChildAXNodes, p, &res)
if err != nil {
return nil, err
}
return res.Nodes, nil
}
// QueryAXTreeParams query a DOM node's accessibility subtree for accessible
// name and role. This command computes the name and role for all nodes in the
// subtree, including those that are ignored for accessibility, and returns
// those that mactch the specified name and role. If no DOM node is specified,
// or the DOM node does not exist, the command returns an error. If neither
// accessibleName or role is specified, it returns all the accessibility nodes
// in the subtree.
type QueryAXTreeParams struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Identifier of the node for the root to query.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Identifier of the backend node for the root to query.
ObjectID runtime.RemoteObjectID `json:"objectId,omitempty"` // JavaScript object id of the node wrapper for the root to query.
AccessibleName string `json:"accessibleName,omitempty"` // Find nodes with this computed name.
Role string `json:"role,omitempty"` // Find nodes with this computed role.
}
// QueryAXTree query a DOM node's accessibility subtree for accessible name
// and role. This command computes the name and role for all nodes in the
// subtree, including those that are ignored for accessibility, and returns
// those that mactch the specified name and role. If no DOM node is specified,
// or the DOM node does not exist, the command returns an error. If neither
// accessibleName or role is specified, it returns all the accessibility nodes
// in the subtree.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#method-queryAXTree
//
// parameters:
func QueryAXTree() *QueryAXTreeParams {
return &QueryAXTreeParams{}
}
// WithNodeID identifier of the node for the root to query.
func (p QueryAXTreeParams) WithNodeID(nodeID cdp.NodeID) *QueryAXTreeParams {
p.NodeID = nodeID
return &p
}
// WithBackendNodeID identifier of the backend node for the root to query.
func (p QueryAXTreeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *QueryAXTreeParams {
p.BackendNodeID = backendNodeID
return &p
}
// WithObjectID JavaScript object id of the node wrapper for the root to
// query.
func (p QueryAXTreeParams) WithObjectID(objectID runtime.RemoteObjectID) *QueryAXTreeParams {
p.ObjectID = objectID
return &p
}
// WithAccessibleName find nodes with this computed name.
func (p QueryAXTreeParams) WithAccessibleName(accessibleName string) *QueryAXTreeParams {
p.AccessibleName = accessibleName
return &p
}
// WithRole find nodes with this computed role.
func (p QueryAXTreeParams) WithRole(role string) *QueryAXTreeParams {
p.Role = role
return &p
}
// QueryAXTreeReturns return values.
type QueryAXTreeReturns struct {
Nodes []*Node `json:"nodes,omitempty"` // A list of Accessibility.AXNode matching the specified attributes, including nodes that are ignored for accessibility.
}
// Do executes Accessibility.queryAXTree against the provided context.
//
// returns:
// nodes - A list of Accessibility.AXNode matching the specified attributes, including nodes that are ignored for accessibility.
func (p *QueryAXTreeParams) Do(ctx context.Context) (nodes []*Node, err error) {
// execute
var res QueryAXTreeReturns
err = cdp.Execute(ctx, CommandQueryAXTree, p, &res)
if err != nil {
return nil, err
}
@@ -150,4 +282,6 @@ const (
CommandEnable = "Accessibility.enable"
CommandGetPartialAXTree = "Accessibility.getPartialAXTree"
CommandGetFullAXTree = "Accessibility.getFullAXTree"
CommandGetChildAXNodes = "Accessibility.getChildAXNodes"
CommandQueryAXTree = "Accessibility.queryAXTree"
)

File diff suppressed because it is too large Load Diff

View File

@@ -179,14 +179,15 @@ func (t ValueNativeSourceType) String() string {
// ValueNativeSourceType values.
const (
ValueNativeSourceTypeFigcaption ValueNativeSourceType = "figcaption"
ValueNativeSourceTypeLabel ValueNativeSourceType = "label"
ValueNativeSourceTypeLabelfor ValueNativeSourceType = "labelfor"
ValueNativeSourceTypeLabelwrapped ValueNativeSourceType = "labelwrapped"
ValueNativeSourceTypeLegend ValueNativeSourceType = "legend"
ValueNativeSourceTypeTablecaption ValueNativeSourceType = "tablecaption"
ValueNativeSourceTypeTitle ValueNativeSourceType = "title"
ValueNativeSourceTypeOther ValueNativeSourceType = "other"
ValueNativeSourceTypeFigcaption ValueNativeSourceType = "figcaption"
ValueNativeSourceTypeLabel ValueNativeSourceType = "label"
ValueNativeSourceTypeLabelfor ValueNativeSourceType = "labelfor"
ValueNativeSourceTypeLabelwrapped ValueNativeSourceType = "labelwrapped"
ValueNativeSourceTypeLegend ValueNativeSourceType = "legend"
ValueNativeSourceTypeRubyannotation ValueNativeSourceType = "rubyannotation"
ValueNativeSourceTypeTablecaption ValueNativeSourceType = "tablecaption"
ValueNativeSourceTypeTitle ValueNativeSourceType = "title"
ValueNativeSourceTypeOther ValueNativeSourceType = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
@@ -212,6 +213,8 @@ func (t *ValueNativeSourceType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = ValueNativeSourceTypeLabelwrapped
case ValueNativeSourceTypeLegend:
*t = ValueNativeSourceTypeLegend
case ValueNativeSourceTypeRubyannotation:
*t = ValueNativeSourceTypeRubyannotation
case ValueNativeSourceTypeTablecaption:
*t = ValueNativeSourceTypeTablecaption
case ValueNativeSourceTypeTitle: