func (c *DOM) GetFlattenedDocument(ctx context.Context, depth int, pierce bool) ([]*DOMNode, error) {
	var v DOMGetFlattenedDocumentParams
	v.Depth = depth
	v.Pierce = pierce
	return c.GetFlattenedDocumentWithParams(ctx, &v)
}
GetFlattenedDocument - Returns the root DOM node (and optionally the subtree) to the caller. Deprecated, as it is not designed to work well with the rest of the DOM agent. Use DOMSnapshot.captureSnapshot instead.
depth - The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
pierce - Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).
Returns -  nodes - Resulting node.
package gcdapi
import (
	"context"
	"github.com/wirepair/gcd/v2/gcdmessage"
)
type DOMBackendNode struct {
	NodeType      int    `json:"nodeType"`       
	NodeName      string `json:"nodeName"`       
	BackendNodeId int    `json:"backendNodeId"`  
}
type DOMNode struct {
	NodeId            int               `json:"nodeId"`                       
	ParentId          int               `json:"parentId,omitempty"`           
	BackendNodeId     int               `json:"backendNodeId"`                
	NodeType          int               `json:"nodeType"`                     
	NodeName          string            `json:"nodeName"`                     
	LocalName         string            `json:"localName"`                    
	NodeValue         string            `json:"nodeValue"`                    
	ChildNodeCount    int               `json:"childNodeCount,omitempty"`     
	Children          []*DOMNode        `json:"children,omitempty"`           
	Attributes        []string          `json:"attributes,omitempty"`         
	DocumentURL       string            `json:"documentURL,omitempty"`        
	BaseURL           string            `json:"baseURL,omitempty"`            
	PublicId          string            `json:"publicId,omitempty"`           
	SystemId          string            `json:"systemId,omitempty"`           
	InternalSubset    string            `json:"internalSubset,omitempty"`     
	XmlVersion        string            `json:"xmlVersion,omitempty"`         
	Name              string            `json:"name,omitempty"`               
	Value             string            `json:"value,omitempty"`              
	PseudoType        string            `json:"pseudoType,omitempty"`         
	ShadowRootType    string            `json:"shadowRootType,omitempty"`     
	FrameId           string            `json:"frameId,omitempty"`            
	ContentDocument   *DOMNode          `json:"contentDocument,omitempty"`    
	ShadowRoots       []*DOMNode        `json:"shadowRoots,omitempty"`        
	TemplateContent   *DOMNode          `json:"templateContent,omitempty"`    
	PseudoElements    []*DOMNode        `json:"pseudoElements,omitempty"`     
	ImportedDocument  *DOMNode          `json:"importedDocument,omitempty"`   
	DistributedNodes  []*DOMBackendNode `json:"distributedNodes,omitempty"`   
	IsSVG             bool              `json:"isSVG,omitempty"`              
	CompatibilityMode string            `json:"compatibilityMode,omitempty"`  
}
type DOMRGBA struct {
	R int     `json:"r"`            
	G int     `json:"g"`            
	B int     `json:"b"`            
	A float64 `json:"a,omitempty"`  
}
type DOMBoxModel struct {
	Content      []float64            `json:"content"`                 
	Padding      []float64            `json:"padding"`                 
	Border       []float64            `json:"border"`                  
	Margin       []float64            `json:"margin"`                  
	Width        int                  `json:"width"`                   
	Height       int                  `json:"height"`                  
	ShapeOutside *DOMShapeOutsideInfo `json:"shapeOutside,omitempty"`  
}
type DOMShapeOutsideInfo struct {
	Bounds      []float64     `json:"bounds"`       
	Shape       []interface{} `json:"shape"`        
	MarginShape []interface{} `json:"marginShape"`  
}
type DOMRect struct {
	X      float64 `json:"x"`       
	Y      float64 `json:"y"`       
	Width  float64 `json:"width"`   
	Height float64 `json:"height"`  
}
type DOMCSSComputedStyleProperty struct {
	Name  string `json:"name"`   
	Value string `json:"value"`  
}
type DOMAttributeModifiedEvent struct {
	Method string `json:"method"`
	Params struct {
		NodeId int    `json:"nodeId"`  
		Name   string `json:"name"`    
		Value  string `json:"value"`   
	} `json:"Params,omitempty"`
}
type DOMAttributeRemovedEvent struct {
	Method string `json:"method"`
	Params struct {
		NodeId int    `json:"nodeId"`  
		Name   string `json:"name"`    
	} `json:"Params,omitempty"`
}
type DOMCharacterDataModifiedEvent struct {
	Method string `json:"method"`
	Params struct {
		NodeId        int    `json:"nodeId"`         
		CharacterData string `json:"characterData"`  
	} `json:"Params,omitempty"`
}
type DOMChildNodeCountUpdatedEvent struct {
	Method string `json:"method"`
	Params struct {
		NodeId         int `json:"nodeId"`          
		ChildNodeCount int `json:"childNodeCount"`  
	} `json:"Params,omitempty"`
}
type DOMChildNodeInsertedEvent struct {
	Method string `json:"method"`
	Params struct {
		ParentNodeId   int      `json:"parentNodeId"`    
		PreviousNodeId int      `json:"previousNodeId"`  
		Node           *DOMNode `json:"node"`            
	} `json:"Params,omitempty"`
}
type DOMChildNodeRemovedEvent struct {
	Method string `json:"method"`
	Params struct {
		ParentNodeId int `json:"parentNodeId"`  
		NodeId       int `json:"nodeId"`        
	} `json:"Params,omitempty"`
}
type DOMDistributedNodesUpdatedEvent struct {
	Method string `json:"method"`
	Params struct {
		InsertionPointId int               `json:"insertionPointId"`  
		DistributedNodes []*DOMBackendNode `json:"distributedNodes"`  
	} `json:"Params,omitempty"`
}
type DOMInlineStyleInvalidatedEvent struct {
	Method string `json:"method"`
	Params struct {
		NodeIds []int `json:"nodeIds"`  
	} `json:"Params,omitempty"`
}
type DOMPseudoElementAddedEvent struct {
	Method string `json:"method"`
	Params struct {
		ParentId      int      `json:"parentId"`       
		PseudoElement *DOMNode `json:"pseudoElement"`  
	} `json:"Params,omitempty"`
}
type DOMPseudoElementRemovedEvent struct {
	Method string `json:"method"`
	Params struct {
		ParentId        int `json:"parentId"`         
		PseudoElementId int `json:"pseudoElementId"`  
	} `json:"Params,omitempty"`
}
type DOMSetChildNodesEvent struct {
	Method string `json:"method"`
	Params struct {
		ParentId int        `json:"parentId"`  
		Nodes    []*DOMNode `json:"nodes"`     
	} `json:"Params,omitempty"`
}
type DOMShadowRootPoppedEvent struct {
	Method string `json:"method"`
	Params struct {
		HostId int `json:"hostId"`  
		RootId int `json:"rootId"`  
	} `json:"Params,omitempty"`
}
type DOMShadowRootPushedEvent struct {
	Method string `json:"method"`
	Params struct {
		HostId int      `json:"hostId"`  
		Root   *DOMNode `json:"root"`    
	} `json:"Params,omitempty"`
}
type DOM struct {
	target gcdmessage.ChromeTargeter
}
func NewDOM(target gcdmessage.ChromeTargeter) *DOM {
	c := &DOM{target: target}
	return c
}
type DOMCollectClassNamesFromSubtreeParams struct {
	NodeId int `json:"nodeId"`
}
func (c *DOM) CollectClassNamesFromSubtreeWithParams(ctx context.Context, v *DOMCollectClassNamesFromSubtreeParams) ([]string, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.collectClassNamesFromSubtree", Params: v})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			ClassNames []string
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.ClassNames, nil
}
func (c *DOM) CollectClassNamesFromSubtree(ctx context.Context, nodeId int) ([]string, error) {
	var v DOMCollectClassNamesFromSubtreeParams
	v.NodeId = nodeId
	return c.CollectClassNamesFromSubtreeWithParams(ctx, &v)
}
type DOMCopyToParams struct {
	NodeId int `json:"nodeId"`
	TargetNodeId int `json:"targetNodeId"`
	InsertBeforeNodeId int `json:"insertBeforeNodeId,omitempty"`
}
func (c *DOM) CopyToWithParams(ctx context.Context, v *DOMCopyToParams) (int, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.copyTo", Params: v})
	if err != nil {
		return 0, err
	}
	var chromeData struct {
		Result struct {
			NodeId int
		}
	}
	if resp == nil {
		return 0, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return 0, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return 0, err
	}
	return chromeData.Result.NodeId, nil
}
func (c *DOM) CopyTo(ctx context.Context, nodeId int, targetNodeId int, insertBeforeNodeId int) (int, error) {
	var v DOMCopyToParams
	v.NodeId = nodeId
	v.TargetNodeId = targetNodeId
	v.InsertBeforeNodeId = insertBeforeNodeId
	return c.CopyToWithParams(ctx, &v)
}
type DOMDescribeNodeParams struct {
	NodeId int `json:"nodeId,omitempty"`
	BackendNodeId int `json:"backendNodeId,omitempty"`
	ObjectId string `json:"objectId,omitempty"`
	Depth int `json:"depth,omitempty"`
	Pierce bool `json:"pierce,omitempty"`
}
func (c *DOM) DescribeNodeWithParams(ctx context.Context, v *DOMDescribeNodeParams) (*DOMNode, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.describeNode", Params: v})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			Node *DOMNode
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.Node, nil
}
func (c *DOM) DescribeNode(ctx context.Context, nodeId int, backendNodeId int, objectId string, depth int, pierce bool) (*DOMNode, error) {
	var v DOMDescribeNodeParams
	v.NodeId = nodeId
	v.BackendNodeId = backendNodeId
	v.ObjectId = objectId
	v.Depth = depth
	v.Pierce = pierce
	return c.DescribeNodeWithParams(ctx, &v)
}
type DOMScrollIntoViewIfNeededParams struct {
	NodeId int `json:"nodeId,omitempty"`
	BackendNodeId int `json:"backendNodeId,omitempty"`
	ObjectId string `json:"objectId,omitempty"`
	Rect *DOMRect `json:"rect,omitempty"`
}
func (c *DOM) ScrollIntoViewIfNeededWithParams(ctx context.Context, v *DOMScrollIntoViewIfNeededParams) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.scrollIntoViewIfNeeded", Params: v})
}
func (c *DOM) ScrollIntoViewIfNeeded(ctx context.Context, nodeId int, backendNodeId int, objectId string, rect *DOMRect) (*gcdmessage.ChromeResponse, error) {
	var v DOMScrollIntoViewIfNeededParams
	v.NodeId = nodeId
	v.BackendNodeId = backendNodeId
	v.ObjectId = objectId
	v.Rect = rect
	return c.ScrollIntoViewIfNeededWithParams(ctx, &v)
}
func (c *DOM) Disable(ctx context.Context) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.disable"})
}
type DOMDiscardSearchResultsParams struct {
	SearchId string `json:"searchId"`
}
func (c *DOM) DiscardSearchResultsWithParams(ctx context.Context, v *DOMDiscardSearchResultsParams) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.discardSearchResults", Params: v})
}
func (c *DOM) DiscardSearchResults(ctx context.Context, searchId string) (*gcdmessage.ChromeResponse, error) {
	var v DOMDiscardSearchResultsParams
	v.SearchId = searchId
	return c.DiscardSearchResultsWithParams(ctx, &v)
}
func (c *DOM) Enable(ctx context.Context) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.enable"})
}
type DOMFocusParams struct {
	NodeId int `json:"nodeId,omitempty"`
	BackendNodeId int `json:"backendNodeId,omitempty"`
	ObjectId string `json:"objectId,omitempty"`
}
func (c *DOM) FocusWithParams(ctx context.Context, v *DOMFocusParams) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.focus", Params: v})
}
func (c *DOM) Focus(ctx context.Context, nodeId int, backendNodeId int, objectId string) (*gcdmessage.ChromeResponse, error) {
	var v DOMFocusParams
	v.NodeId = nodeId
	v.BackendNodeId = backendNodeId
	v.ObjectId = objectId
	return c.FocusWithParams(ctx, &v)
}
type DOMGetAttributesParams struct {
	NodeId int `json:"nodeId"`
}
func (c *DOM) GetAttributesWithParams(ctx context.Context, v *DOMGetAttributesParams) ([]string, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.getAttributes", Params: v})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			Attributes []string
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.Attributes, nil
}
func (c *DOM) GetAttributes(ctx context.Context, nodeId int) ([]string, error) {
	var v DOMGetAttributesParams
	v.NodeId = nodeId
	return c.GetAttributesWithParams(ctx, &v)
}
type DOMGetBoxModelParams struct {
	NodeId int `json:"nodeId,omitempty"`
	BackendNodeId int `json:"backendNodeId,omitempty"`
	ObjectId string `json:"objectId,omitempty"`
}
func (c *DOM) GetBoxModelWithParams(ctx context.Context, v *DOMGetBoxModelParams) (*DOMBoxModel, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.getBoxModel", Params: v})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			Model *DOMBoxModel
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.Model, nil
}
func (c *DOM) GetBoxModel(ctx context.Context, nodeId int, backendNodeId int, objectId string) (*DOMBoxModel, error) {
	var v DOMGetBoxModelParams
	v.NodeId = nodeId
	v.BackendNodeId = backendNodeId
	v.ObjectId = objectId
	return c.GetBoxModelWithParams(ctx, &v)
}
type DOMGetContentQuadsParams struct {
	NodeId int `json:"nodeId,omitempty"`
	BackendNodeId int `json:"backendNodeId,omitempty"`
	ObjectId string `json:"objectId,omitempty"`
}
func (c *DOM) GetContentQuadsWithParams(ctx context.Context, v *DOMGetContentQuadsParams) ([]float64, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.getContentQuads", Params: v})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			Quads []float64
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.Quads, nil
}
func (c *DOM) GetContentQuads(ctx context.Context, nodeId int, backendNodeId int, objectId string) ([]float64, error) {
	var v DOMGetContentQuadsParams
	v.NodeId = nodeId
	v.BackendNodeId = backendNodeId
	v.ObjectId = objectId
	return c.GetContentQuadsWithParams(ctx, &v)
}
type DOMGetDocumentParams struct {
	Depth int `json:"depth,omitempty"`
	Pierce bool `json:"pierce,omitempty"`
}
func (c *DOM) GetDocumentWithParams(ctx context.Context, v *DOMGetDocumentParams) (*DOMNode, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.getDocument", Params: v})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			Root *DOMNode
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.Root, nil
}
func (c *DOM) GetDocument(ctx context.Context, depth int, pierce bool) (*DOMNode, error) {
	var v DOMGetDocumentParams
	v.Depth = depth
	v.Pierce = pierce
	return c.GetDocumentWithParams(ctx, &v)
}
type DOMGetFlattenedDocumentParams struct {
	Depth int `json:"depth,omitempty"`
	Pierce bool `json:"pierce,omitempty"`
}
func (c *DOM) GetFlattenedDocumentWithParams(ctx context.Context, v *DOMGetFlattenedDocumentParams) ([]*DOMNode, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.getFlattenedDocument", Params: v})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			Nodes []*DOMNode
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.Nodes, nil
}