id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
134,500
chromedp/chromedp
conn.go
Read
func (c *Conn) Read(_ context.Context, msg *cdproto.Message) error { // get websocket reader typ, r, err := c.conn.NextReader() if err != nil { return err } if typ != websocket.TextMessage { return ErrInvalidWebsocketMessage } // Unmarshal via a bytes.Buffer. Don't use UnmarshalFromReader, as that // uses ...
go
func (c *Conn) Read(_ context.Context, msg *cdproto.Message) error { // get websocket reader typ, r, err := c.conn.NextReader() if err != nil { return err } if typ != websocket.TextMessage { return ErrInvalidWebsocketMessage } // Unmarshal via a bytes.Buffer. Don't use UnmarshalFromReader, as that // uses ...
[ "func", "(", "c", "*", "Conn", ")", "Read", "(", "_", "context", ".", "Context", ",", "msg", "*", "cdproto", ".", "Message", ")", "error", "{", "// get websocket reader", "typ", ",", "r", ",", "err", ":=", "c", ".", "conn", ".", "NextReader", "(", ...
// Read reads the next message.
[ "Read", "reads", "the", "next", "message", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/conn.go#L73-L105
134,501
chromedp/chromedp
conn.go
Write
func (c *Conn) Write(_ context.Context, msg *cdproto.Message) error { w, err := c.conn.NextWriter(websocket.TextMessage) if err != nil { return err } defer w.Close() // Reuse the easyjson writer. c.writer = jwriter.Writer{} // Perform the marshal. msg.MarshalEasyJSON(&c.writer) if err := c.writer.Error; er...
go
func (c *Conn) Write(_ context.Context, msg *cdproto.Message) error { w, err := c.conn.NextWriter(websocket.TextMessage) if err != nil { return err } defer w.Close() // Reuse the easyjson writer. c.writer = jwriter.Writer{} // Perform the marshal. msg.MarshalEasyJSON(&c.writer) if err := c.writer.Error; er...
[ "func", "(", "c", "*", "Conn", ")", "Write", "(", "_", "context", ".", "Context", ",", "msg", "*", "cdproto", ".", "Message", ")", "error", "{", "w", ",", "err", ":=", "c", ".", "conn", ".", "NextWriter", "(", "websocket", ".", "TextMessage", ")", ...
// Write writes a message.
[ "Write", "writes", "a", "message", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/conn.go#L108-L138
134,502
chromedp/chromedp
sel.go
Query
func Query(sel interface{}, opts ...QueryOption) Action { s := &Selector{ sel: sel, exp: 1, } // apply options for _, o := range opts { o(s) } if s.by == nil { BySearch(s) } if s.wait == nil { NodeReady(s) } return s }
go
func Query(sel interface{}, opts ...QueryOption) Action { s := &Selector{ sel: sel, exp: 1, } // apply options for _, o := range opts { o(s) } if s.by == nil { BySearch(s) } if s.wait == nil { NodeReady(s) } return s }
[ "func", "Query", "(", "sel", "interface", "{", "}", ",", "opts", "...", "QueryOption", ")", "Action", "{", "s", ":=", "&", "Selector", "{", "sel", ":", "sel", ",", "exp", ":", "1", ",", "}", "\n\n", "// apply options", "for", "_", ",", "o", ":=", ...
// Query is an action to query for document nodes match the specified sel and // the supplied query options.
[ "Query", "is", "an", "action", "to", "query", "for", "document", "nodes", "match", "the", "specified", "sel", "and", "the", "supplied", "query", "options", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L34-L54
134,503
chromedp/chromedp
sel.go
Do
func (s *Selector) Do(ctx context.Context) error { t := cdp.ExecutorFromContext(ctx).(*Target) if t == nil { return ErrInvalidTarget } var err error select { case <-ctx.Done(): err = ctx.Err() case err = <-s.run(ctx, t): } return err }
go
func (s *Selector) Do(ctx context.Context) error { t := cdp.ExecutorFromContext(ctx).(*Target) if t == nil { return ErrInvalidTarget } var err error select { case <-ctx.Done(): err = ctx.Err() case err = <-s.run(ctx, t): } return err }
[ "func", "(", "s", "*", "Selector", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "error", "{", "t", ":=", "cdp", ".", "ExecutorFromContext", "(", "ctx", ")", ".", "(", "*", "Target", ")", "\n", "if", "t", "==", "nil", "{", "return", "Err...
// Do satisfies the Action interface.
[ "Do", "satisfies", "the", "Action", "interface", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L57-L69
134,504
chromedp/chromedp
sel.go
run
func (s *Selector) run(ctx context.Context, t *Target) chan error { ch := make(chan error, 1) t.waitQueue <- func() bool { cur := t.cur cur.RLock() root := cur.Root cur.RUnlock() if root == nil { // not ready? return false } ids, err := s.by(ctx, root) if err != nil || len(ids) < s.exp { re...
go
func (s *Selector) run(ctx context.Context, t *Target) chan error { ch := make(chan error, 1) t.waitQueue <- func() bool { cur := t.cur cur.RLock() root := cur.Root cur.RUnlock() if root == nil { // not ready? return false } ids, err := s.by(ctx, root) if err != nil || len(ids) < s.exp { re...
[ "func", "(", "s", "*", "Selector", ")", "run", "(", "ctx", "context", ".", "Context", ",", "t", "*", "Target", ")", "chan", "error", "{", "ch", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "t", ".", "waitQueue", "<-", "func", "(", "...
// run runs the selector action, starting over if the original returned nodes // are invalidated prior to finishing the selector's by, wait, check, and after // funcs.
[ "run", "runs", "the", "selector", "action", "starting", "over", "if", "the", "original", "returned", "nodes", "are", "invalidated", "prior", "to", "finishing", "the", "selector", "s", "by", "wait", "check", "and", "after", "funcs", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L74-L105
134,505
chromedp/chromedp
sel.go
selAsString
func (s *Selector) selAsString() string { if sel, ok := s.sel.(string); ok { return sel } return fmt.Sprintf("%s", s.sel) }
go
func (s *Selector) selAsString() string { if sel, ok := s.sel.(string); ok { return sel } return fmt.Sprintf("%s", s.sel) }
[ "func", "(", "s", "*", "Selector", ")", "selAsString", "(", ")", "string", "{", "if", "sel", ",", "ok", ":=", "s", ".", "sel", ".", "(", "string", ")", ";", "ok", "{", "return", "sel", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\...
// selAsString forces sel into a string.
[ "selAsString", "forces", "sel", "into", "a", "string", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L108-L114
134,506
chromedp/chromedp
sel.go
QueryAfter
func QueryAfter(sel interface{}, f func(context.Context, ...*cdp.Node) error, opts ...QueryOption) Action { return Query(sel, append(opts, After(f))...) }
go
func QueryAfter(sel interface{}, f func(context.Context, ...*cdp.Node) error, opts ...QueryOption) Action { return Query(sel, append(opts, After(f))...) }
[ "func", "QueryAfter", "(", "sel", "interface", "{", "}", ",", "f", "func", "(", "context", ".", "Context", ",", "...", "*", "cdp", ".", "Node", ")", "error", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "Query", "(", "sel", ",", ...
// QueryAfter is an action that will match the specified sel using the supplied // query options, and after the visibility conditions of the query have been // met, will execute f.
[ "QueryAfter", "is", "an", "action", "that", "will", "match", "the", "specified", "sel", "using", "the", "supplied", "query", "options", "and", "after", "the", "visibility", "conditions", "of", "the", "query", "have", "been", "met", "will", "execute", "f", "....
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L119-L121
134,507
chromedp/chromedp
sel.go
ByFunc
func ByFunc(f func(context.Context, *cdp.Node) ([]cdp.NodeID, error)) QueryOption { return func(s *Selector) { s.by = f } }
go
func ByFunc(f func(context.Context, *cdp.Node) ([]cdp.NodeID, error)) QueryOption { return func(s *Selector) { s.by = f } }
[ "func", "ByFunc", "(", "f", "func", "(", "context", ".", "Context", ",", "*", "cdp", ".", "Node", ")", "(", "[", "]", "cdp", ".", "NodeID", ",", "error", ")", ")", "QueryOption", "{", "return", "func", "(", "s", "*", "Selector", ")", "{", "s", ...
// ByFunc is a query option to set the func used to select elements.
[ "ByFunc", "is", "a", "query", "option", "to", "set", "the", "func", "used", "to", "select", "elements", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L127-L131
134,508
chromedp/chromedp
sel.go
ByQuery
func ByQuery(s *Selector) { ByFunc(func(ctx context.Context, n *cdp.Node) ([]cdp.NodeID, error) { nodeID, err := dom.QuerySelector(n.NodeID, s.selAsString()).Do(ctx) if err != nil { return nil, err } if nodeID == cdp.EmptyNodeID { return []cdp.NodeID{}, nil } return []cdp.NodeID{nodeID}, nil })(s)...
go
func ByQuery(s *Selector) { ByFunc(func(ctx context.Context, n *cdp.Node) ([]cdp.NodeID, error) { nodeID, err := dom.QuerySelector(n.NodeID, s.selAsString()).Do(ctx) if err != nil { return nil, err } if nodeID == cdp.EmptyNodeID { return []cdp.NodeID{}, nil } return []cdp.NodeID{nodeID}, nil })(s)...
[ "func", "ByQuery", "(", "s", "*", "Selector", ")", "{", "ByFunc", "(", "func", "(", "ctx", "context", ".", "Context", ",", "n", "*", "cdp", ".", "Node", ")", "(", "[", "]", "cdp", ".", "NodeID", ",", "error", ")", "{", "nodeID", ",", "err", ":=...
// ByQuery is a query option to select a single element using // DOM.querySelector.
[ "ByQuery", "is", "a", "query", "option", "to", "select", "a", "single", "element", "using", "DOM", ".", "querySelector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L135-L148
134,509
chromedp/chromedp
sel.go
ByQueryAll
func ByQueryAll(s *Selector) { ByFunc(func(ctx context.Context, n *cdp.Node) ([]cdp.NodeID, error) { return dom.QuerySelectorAll(n.NodeID, s.selAsString()).Do(ctx) })(s) }
go
func ByQueryAll(s *Selector) { ByFunc(func(ctx context.Context, n *cdp.Node) ([]cdp.NodeID, error) { return dom.QuerySelectorAll(n.NodeID, s.selAsString()).Do(ctx) })(s) }
[ "func", "ByQueryAll", "(", "s", "*", "Selector", ")", "{", "ByFunc", "(", "func", "(", "ctx", "context", ".", "Context", ",", "n", "*", "cdp", ".", "Node", ")", "(", "[", "]", "cdp", ".", "NodeID", ",", "error", ")", "{", "return", "dom", ".", ...
// ByQueryAll is a query option to select elements by DOM.querySelectorAll.
[ "ByQueryAll", "is", "a", "query", "option", "to", "select", "elements", "by", "DOM", ".", "querySelectorAll", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L151-L155
134,510
chromedp/chromedp
sel.go
ByNodeID
func ByNodeID(s *Selector) { ids, ok := s.sel.([]cdp.NodeID) if !ok { panic("ByNodeID can only work on []cdp.NodeID") } ByFunc(func(ctx context.Context, n *cdp.Node) ([]cdp.NodeID, error) { for _, id := range ids { err := dom.RequestChildNodes(id).WithPierce(true).Do(ctx) if err != nil { return nil, ...
go
func ByNodeID(s *Selector) { ids, ok := s.sel.([]cdp.NodeID) if !ok { panic("ByNodeID can only work on []cdp.NodeID") } ByFunc(func(ctx context.Context, n *cdp.Node) ([]cdp.NodeID, error) { for _, id := range ids { err := dom.RequestChildNodes(id).WithPierce(true).Do(ctx) if err != nil { return nil, ...
[ "func", "ByNodeID", "(", "s", "*", "Selector", ")", "{", "ids", ",", "ok", ":=", "s", ".", "sel", ".", "(", "[", "]", "cdp", ".", "NodeID", ")", "\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "ByFunc", "(", "f...
// ByNodeID is a query option to select elements by their NodeIDs.
[ "ByNodeID", "is", "a", "query", "option", "to", "select", "elements", "by", "their", "NodeIDs", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L186-L202
134,511
chromedp/chromedp
sel.go
waitReady
func (s *Selector) waitReady(check func(context.Context, *cdp.Node) error) func(context.Context, *cdp.Frame, ...cdp.NodeID) ([]*cdp.Node, error) { errc := make(chan error, 1) return func(ctx context.Context, cur *cdp.Frame, ids ...cdp.NodeID) ([]*cdp.Node, error) { nodes := make([]*cdp.Node, len(ids)) cur.RLock()...
go
func (s *Selector) waitReady(check func(context.Context, *cdp.Node) error) func(context.Context, *cdp.Frame, ...cdp.NodeID) ([]*cdp.Node, error) { errc := make(chan error, 1) return func(ctx context.Context, cur *cdp.Frame, ids ...cdp.NodeID) ([]*cdp.Node, error) { nodes := make([]*cdp.Node, len(ids)) cur.RLock()...
[ "func", "(", "s", "*", "Selector", ")", "waitReady", "(", "check", "func", "(", "context", ".", "Context", ",", "*", "cdp", ".", "Node", ")", "error", ")", "func", "(", "context", ".", "Context", ",", "*", "cdp", ".", "Frame", ",", "...", "cdp", ...
// waitReady waits for the specified nodes to be ready.
[ "waitReady", "waits", "for", "the", "specified", "nodes", "to", "be", "ready", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L205-L241
134,512
chromedp/chromedp
sel.go
WaitFunc
func WaitFunc(wait func(context.Context, *cdp.Frame, ...cdp.NodeID) ([]*cdp.Node, error)) QueryOption { return func(s *Selector) { s.wait = wait } }
go
func WaitFunc(wait func(context.Context, *cdp.Frame, ...cdp.NodeID) ([]*cdp.Node, error)) QueryOption { return func(s *Selector) { s.wait = wait } }
[ "func", "WaitFunc", "(", "wait", "func", "(", "context", ".", "Context", ",", "*", "cdp", ".", "Frame", ",", "...", "cdp", ".", "NodeID", ")", "(", "[", "]", "*", "cdp", ".", "Node", ",", "error", ")", ")", "QueryOption", "{", "return", "func", "...
// WaitFunc is a query option to set a custom wait func.
[ "WaitFunc", "is", "a", "query", "option", "to", "set", "a", "custom", "wait", "func", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L244-L248
134,513
chromedp/chromedp
sel.go
NodeVisible
func NodeVisible(s *Selector) { WaitFunc(s.waitReady(func(ctx context.Context, n *cdp.Node) error { // check box model _, err := dom.GetBoxModel().WithNodeID(n.NodeID).Do(ctx) if err != nil { if isCouldNotComputeBoxModelError(err) { return ErrNotVisible } return err } // check offsetParent v...
go
func NodeVisible(s *Selector) { WaitFunc(s.waitReady(func(ctx context.Context, n *cdp.Node) error { // check box model _, err := dom.GetBoxModel().WithNodeID(n.NodeID).Do(ctx) if err != nil { if isCouldNotComputeBoxModelError(err) { return ErrNotVisible } return err } // check offsetParent v...
[ "func", "NodeVisible", "(", "s", "*", "Selector", ")", "{", "WaitFunc", "(", "s", ".", "waitReady", "(", "func", "(", "ctx", "context", ".", "Context", ",", "n", "*", "cdp", ".", "Node", ")", "error", "{", "// check box model", "_", ",", "err", ":=",...
// NodeVisible is a query option to wait until the element is visible.
[ "NodeVisible", "is", "a", "query", "option", "to", "wait", "until", "the", "element", "is", "visible", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L256-L279
134,514
chromedp/chromedp
sel.go
NodeEnabled
func NodeEnabled(s *Selector) { WaitFunc(s.waitReady(func(ctx context.Context, n *cdp.Node) error { n.RLock() defer n.RUnlock() for i := 0; i < len(n.Attributes); i += 2 { if n.Attributes[i] == "disabled" { return ErrDisabled } } return nil }))(s) }
go
func NodeEnabled(s *Selector) { WaitFunc(s.waitReady(func(ctx context.Context, n *cdp.Node) error { n.RLock() defer n.RUnlock() for i := 0; i < len(n.Attributes); i += 2 { if n.Attributes[i] == "disabled" { return ErrDisabled } } return nil }))(s) }
[ "func", "NodeEnabled", "(", "s", "*", "Selector", ")", "{", "WaitFunc", "(", "s", ".", "waitReady", "(", "func", "(", "ctx", "context", ".", "Context", ",", "n", "*", "cdp", ".", "Node", ")", "error", "{", "n", ".", "RLock", "(", ")", "\n", "defe...
// NodeEnabled is a query option to wait until the element is enabled.
[ "NodeEnabled", "is", "a", "query", "option", "to", "wait", "until", "the", "element", "is", "enabled", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L308-L321
134,515
chromedp/chromedp
sel.go
NodeNotPresent
func NodeNotPresent(s *Selector) { s.exp = 0 WaitFunc(func(ctx context.Context, cur *cdp.Frame, ids ...cdp.NodeID) ([]*cdp.Node, error) { if len(ids) != 0 { return nil, ErrHasResults } return []*cdp.Node{}, nil })(s) }
go
func NodeNotPresent(s *Selector) { s.exp = 0 WaitFunc(func(ctx context.Context, cur *cdp.Frame, ids ...cdp.NodeID) ([]*cdp.Node, error) { if len(ids) != 0 { return nil, ErrHasResults } return []*cdp.Node{}, nil })(s) }
[ "func", "NodeNotPresent", "(", "s", "*", "Selector", ")", "{", "s", ".", "exp", "=", "0", "\n", "WaitFunc", "(", "func", "(", "ctx", "context", ".", "Context", ",", "cur", "*", "cdp", ".", "Frame", ",", "ids", "...", "cdp", ".", "NodeID", ")", "(...
// NodeNotPresent is a query option to wait until no elements are present // matching the selector.
[ "NodeNotPresent", "is", "a", "query", "option", "to", "wait", "until", "no", "elements", "are", "present", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L341-L349
134,516
chromedp/chromedp
sel.go
After
func After(f func(context.Context, ...*cdp.Node) error) QueryOption { return func(s *Selector) { s.after = f } }
go
func After(f func(context.Context, ...*cdp.Node) error) QueryOption { return func(s *Selector) { s.after = f } }
[ "func", "After", "(", "f", "func", "(", "context", ".", "Context", ",", "...", "*", "cdp", ".", "Node", ")", "error", ")", "QueryOption", "{", "return", "func", "(", "s", "*", "Selector", ")", "{", "s", ".", "after", "=", "f", "\n", "}", "\n", ...
// After is a query option to set a func that will be executed after the wait // has succeeded.
[ "After", "is", "a", "query", "option", "to", "set", "a", "func", "that", "will", "be", "executed", "after", "the", "wait", "has", "succeeded", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L361-L365
134,517
chromedp/chromedp
sel.go
WaitVisible
func WaitVisible(sel interface{}, opts ...QueryOption) Action { return Query(sel, append(opts, NodeVisible)...) }
go
func WaitVisible(sel interface{}, opts ...QueryOption) Action { return Query(sel, append(opts, NodeVisible)...) }
[ "func", "WaitVisible", "(", "sel", "interface", "{", "}", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "Query", "(", "sel", ",", "append", "(", "opts", ",", "NodeVisible", ")", "...", ")", "\n", "}" ]
// WaitVisible waits until the selected element is visible.
[ "WaitVisible", "waits", "until", "the", "selected", "element", "is", "visible", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L373-L375
134,518
chromedp/chromedp
sel.go
WaitNotVisible
func WaitNotVisible(sel interface{}, opts ...QueryOption) Action { return Query(sel, append(opts, NodeNotVisible)...) }
go
func WaitNotVisible(sel interface{}, opts ...QueryOption) Action { return Query(sel, append(opts, NodeNotVisible)...) }
[ "func", "WaitNotVisible", "(", "sel", "interface", "{", "}", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "Query", "(", "sel", ",", "append", "(", "opts", ",", "NodeNotVisible", ")", "...", ")", "\n", "}" ]
// WaitNotVisible waits until the selected element is not visible.
[ "WaitNotVisible", "waits", "until", "the", "selected", "element", "is", "not", "visible", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L378-L380
134,519
chromedp/chromedp
sel.go
WaitNotPresent
func WaitNotPresent(sel interface{}, opts ...QueryOption) Action { return Query(sel, append(opts, NodeNotPresent)...) }
go
func WaitNotPresent(sel interface{}, opts ...QueryOption) Action { return Query(sel, append(opts, NodeNotPresent)...) }
[ "func", "WaitNotPresent", "(", "sel", "interface", "{", "}", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "Query", "(", "sel", ",", "append", "(", "opts", ",", "NodeNotPresent", ")", "...", ")", "\n", "}" ]
// WaitNotPresent waits until no elements match the specified selector.
[ "WaitNotPresent", "waits", "until", "no", "elements", "match", "the", "specified", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/sel.go#L394-L396
134,520
chromedp/chromedp
util.go
isCouldNotComputeBoxModelError
func isCouldNotComputeBoxModelError(err error) bool { e, ok := err.(*cdproto.Error) return ok && e.Code == -32000 && e.Message == "Could not compute box model." }
go
func isCouldNotComputeBoxModelError(err error) bool { e, ok := err.(*cdproto.Error) return ok && e.Code == -32000 && e.Message == "Could not compute box model." }
[ "func", "isCouldNotComputeBoxModelError", "(", "err", "error", ")", "bool", "{", "e", ",", "ok", ":=", "err", ".", "(", "*", "cdproto", ".", "Error", ")", "\n", "return", "ok", "&&", "e", ".", "Code", "==", "-", "32000", "&&", "e", ".", "Message", ...
// isCouldNotComputeBoxModelError unwraps err as a MessageError and determines // if it is a compute box model error.
[ "isCouldNotComputeBoxModelError", "unwraps", "err", "as", "a", "MessageError", "and", "determines", "if", "it", "is", "a", "compute", "box", "model", "error", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/util.go#L298-L301
134,521
chromedp/chromedp
kb/kb.go
Encode
func Encode(r rune) []*input.DispatchKeyEventParams { // force \n -> \r if r == '\n' { r = '\r' } // if not known key, encode as unidentified v, ok := Keys[r] if !ok { return EncodeUnidentified(r) } // create keyDown := input.DispatchKeyEventParams{ Key: v.Key, Code: ...
go
func Encode(r rune) []*input.DispatchKeyEventParams { // force \n -> \r if r == '\n' { r = '\r' } // if not known key, encode as unidentified v, ok := Keys[r] if !ok { return EncodeUnidentified(r) } // create keyDown := input.DispatchKeyEventParams{ Key: v.Key, Code: ...
[ "func", "Encode", "(", "r", "rune", ")", "[", "]", "*", "input", ".", "DispatchKeyEventParams", "{", "// force \\n -> \\r", "if", "r", "==", "'\\n'", "{", "r", "=", "'\\r'", "\n", "}", "\n\n", "// if not known key, encode as unidentified", "v", ",", "ok", ":...
// Encode encodes a keyDown, char, and keyUp sequence for the specified rune.
[ "Encode", "encodes", "a", "keyDown", "char", "and", "keyUp", "sequence", "for", "the", "specified", "rune", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/kb.go#L82-L129
134,522
chromedp/chromedp
allocate.go
setupExecAllocator
func setupExecAllocator(opts ...ExecAllocatorOption) *ExecAllocator { ep := &ExecAllocator{ initFlags: make(map[string]interface{}), } for _, o := range opts { o(ep) } if ep.execPath == "" { ep.execPath = findExecPath() } return ep }
go
func setupExecAllocator(opts ...ExecAllocatorOption) *ExecAllocator { ep := &ExecAllocator{ initFlags: make(map[string]interface{}), } for _, o := range opts { o(ep) } if ep.execPath == "" { ep.execPath = findExecPath() } return ep }
[ "func", "setupExecAllocator", "(", "opts", "...", "ExecAllocatorOption", ")", "*", "ExecAllocator", "{", "ep", ":=", "&", "ExecAllocator", "{", "initFlags", ":", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", ",", "}", "\n", "for", "...
// setupExecAllocator is similar to NewExecAllocator, but it allows NewContext // to create the allocator without the unnecessary context layer.
[ "setupExecAllocator", "is", "similar", "to", "NewExecAllocator", "but", "it", "allows", "NewContext", "to", "create", "the", "allocator", "without", "the", "unnecessary", "context", "layer", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/allocate.go#L34-L45
134,523
chromedp/chromedp
allocate.go
NewExecAllocator
func NewExecAllocator(parent context.Context, opts ...ExecAllocatorOption) (context.Context, context.CancelFunc) { ctx, cancel := context.WithCancel(parent) c := &Context{Allocator: setupExecAllocator(opts...)} ctx = context.WithValue(ctx, contextKey{}, c) cancelWait := func() { cancel() c.Allocator.Wait() } ...
go
func NewExecAllocator(parent context.Context, opts ...ExecAllocatorOption) (context.Context, context.CancelFunc) { ctx, cancel := context.WithCancel(parent) c := &Context{Allocator: setupExecAllocator(opts...)} ctx = context.WithValue(ctx, contextKey{}, c) cancelWait := func() { cancel() c.Allocator.Wait() } ...
[ "func", "NewExecAllocator", "(", "parent", "context", ".", "Context", ",", "opts", "...", "ExecAllocatorOption", ")", "(", "context", ".", "Context", ",", "context", ".", "CancelFunc", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", ...
// NewExecAllocator creates a new context set up with an ExecAllocator, suitable // for use with NewContext.
[ "NewExecAllocator", "creates", "a", "new", "context", "set", "up", "with", "an", "ExecAllocator", "suitable", "for", "use", "with", "NewContext", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/allocate.go#L57-L67
134,524
chromedp/chromedp
allocate.go
addrFromStderr
func addrFromStderr(rc io.ReadCloser) (string, error) { defer rc.Close() url := "" scanner := bufio.NewScanner(rc) prefix := "DevTools listening on" var lines []string for scanner.Scan() { line := scanner.Text() if s := strings.TrimPrefix(line, prefix); s != line { url = strings.TrimSpace(s) break } ...
go
func addrFromStderr(rc io.ReadCloser) (string, error) { defer rc.Close() url := "" scanner := bufio.NewScanner(rc) prefix := "DevTools listening on" var lines []string for scanner.Scan() { line := scanner.Text() if s := strings.TrimPrefix(line, prefix); s != line { url = strings.TrimSpace(s) break } ...
[ "func", "addrFromStderr", "(", "rc", "io", ".", "ReadCloser", ")", "(", "string", ",", "error", ")", "{", "defer", "rc", ".", "Close", "(", ")", "\n", "url", ":=", "\"", "\"", "\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "rc", ")", "\n",...
// addrFromStderr finds the free port that Chrome selected for the debugging // protocol. This should be hooked up to a new Chrome process's Stderr pipe // right after it is started.
[ "addrFromStderr", "finds", "the", "free", "port", "that", "Chrome", "selected", "for", "the", "debugging", "protocol", ".", "This", "should", "be", "hooked", "up", "to", "a", "new", "Chrome", "process", "s", "Stderr", "pipe", "right", "after", "it", "is", ...
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/allocate.go#L197-L220
134,525
chromedp/chromedp
allocate.go
ExecPath
func ExecPath(path string) ExecAllocatorOption { return func(a *ExecAllocator) { // Convert to an absolute path if possible, to avoid // repeated LookPath calls in each Allocate. if fullPath, _ := exec.LookPath(path); fullPath != "" { a.execPath = fullPath } else { a.execPath = path } } }
go
func ExecPath(path string) ExecAllocatorOption { return func(a *ExecAllocator) { // Convert to an absolute path if possible, to avoid // repeated LookPath calls in each Allocate. if fullPath, _ := exec.LookPath(path); fullPath != "" { a.execPath = fullPath } else { a.execPath = path } } }
[ "func", "ExecPath", "(", "path", "string", ")", "ExecAllocatorOption", "{", "return", "func", "(", "a", "*", "ExecAllocator", ")", "{", "// Convert to an absolute path if possible, to avoid", "// repeated LookPath calls in each Allocate.", "if", "fullPath", ",", "_", ":="...
// ExecPath returns an ExecAllocatorOption which uses the given path to execute // browser processes. The given path can be an absolute path to a binary, or // just the name of the program to find via exec.LookPath.
[ "ExecPath", "returns", "an", "ExecAllocatorOption", "which", "uses", "the", "given", "path", "to", "execute", "browser", "processes", ".", "The", "given", "path", "can", "be", "an", "absolute", "path", "to", "a", "binary", "or", "just", "the", "name", "of", ...
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/allocate.go#L230-L240
134,526
chromedp/chromedp
allocate.go
findExecPath
func findExecPath() string { for _, path := range [...]string{ // Unix-like "headless_shell", "headless-shell", "chromium", "chromium-browser", "google-chrome", "google-chrome-stable", "google-chrome-beta", "google-chrome-unstable", "/usr/bin/google-chrome", // Windows "chrome", "chrome.exe"...
go
func findExecPath() string { for _, path := range [...]string{ // Unix-like "headless_shell", "headless-shell", "chromium", "chromium-browser", "google-chrome", "google-chrome-stable", "google-chrome-beta", "google-chrome-unstable", "/usr/bin/google-chrome", // Windows "chrome", "chrome.exe"...
[ "func", "findExecPath", "(", ")", "string", "{", "for", "_", ",", "path", ":=", "range", "[", "...", "]", "string", "{", "// Unix-like", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"",...
// findExecPath tries to find the Chrome browser somewhere in the current // system. It performs a rather agressive search, which is the same in all // systems. That may make it a bit slow, but it will only be run when creating a // new ExecAllocator.
[ "findExecPath", "tries", "to", "find", "the", "Chrome", "browser", "somewhere", "in", "the", "current", "system", ".", "It", "performs", "a", "rather", "agressive", "search", "which", "is", "the", "same", "in", "all", "systems", ".", "That", "may", "make", ...
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/allocate.go#L246-L275
134,527
chromedp/chromedp
allocate.go
WindowSize
func WindowSize(width, height int) ExecAllocatorOption { return Flag("window-size", fmt.Sprintf("%d,%d", width, height)) }
go
func WindowSize(width, height int) ExecAllocatorOption { return Flag("window-size", fmt.Sprintf("%d,%d", width, height)) }
[ "func", "WindowSize", "(", "width", ",", "height", "int", ")", "ExecAllocatorOption", "{", "return", "Flag", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "width", ",", "height", ")", ")", "\n", "}" ]
// WindowSize is the command line option to set the initial window size.
[ "WindowSize", "is", "the", "command", "line", "option", "to", "set", "the", "initial", "window", "size", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/allocate.go#L301-L303
134,528
chromedp/chromedp
allocate.go
NewRemoteAllocator
func NewRemoteAllocator(parent context.Context, url string) (context.Context, context.CancelFunc) { ctx, cancel := context.WithCancel(parent) c := &Context{Allocator: &RemoteAllocator{ wsURL: url, }} ctx = context.WithValue(ctx, contextKey{}, c) return ctx, cancel }
go
func NewRemoteAllocator(parent context.Context, url string) (context.Context, context.CancelFunc) { ctx, cancel := context.WithCancel(parent) c := &Context{Allocator: &RemoteAllocator{ wsURL: url, }} ctx = context.WithValue(ctx, contextKey{}, c) return ctx, cancel }
[ "func", "NewRemoteAllocator", "(", "parent", "context", ".", "Context", ",", "url", "string", ")", "(", "context", ".", "Context", ",", "context", ".", "CancelFunc", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "parent", ")", ...
// NewRemoteAllocator creates a new context set up with a RemoteAllocator, // suitable for use with NewContext.
[ "NewRemoteAllocator", "creates", "a", "new", "context", "set", "up", "with", "a", "RemoteAllocator", "suitable", "for", "use", "with", "NewContext", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/allocate.go#L340-L347
134,529
chromedp/chromedp
kb/gen.go
loadKeys
func loadKeys(keys map[rune]kb.Key) error { // load key converter data keycodeConverterMap, err := loadKeycodeConverterData() if err != nil { return err } // load dom code map domKeyMap, err := loadDomKeyData() if err != nil { return err } // load US layout data layoutBuf, err := grab(domUsLayoutDataH) ...
go
func loadKeys(keys map[rune]kb.Key) error { // load key converter data keycodeConverterMap, err := loadKeycodeConverterData() if err != nil { return err } // load dom code map domKeyMap, err := loadDomKeyData() if err != nil { return err } // load US layout data layoutBuf, err := grab(domUsLayoutDataH) ...
[ "func", "loadKeys", "(", "keys", "map", "[", "rune", "]", "kb", ".", "Key", ")", "error", "{", "// load key converter data", "keycodeConverterMap", ",", "err", ":=", "loadKeycodeConverterData", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", ...
// loadKeys loads the dom key definitions from the chromium source tree.
[ "loadKeys", "loads", "the", "dom", "key", "definitions", "from", "the", "chromium", "source", "tree", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L112-L150
134,530
chromedp/chromedp
kb/gen.go
loadKeycodeConverterData
func loadKeycodeConverterData() (map[string][]string, error) { buf, err := grab(keycodeConverterDataInc) if err != nil { return nil, err } buf = fixRE.ReplaceAllLiteral(buf, []byte(", ")) domMap := make(map[string][]string) matches := usbKeyRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches {...
go
func loadKeycodeConverterData() (map[string][]string, error) { buf, err := grab(keycodeConverterDataInc) if err != nil { return nil, err } buf = fixRE.ReplaceAllLiteral(buf, []byte(", ")) domMap := make(map[string][]string) matches := usbKeyRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches {...
[ "func", "loadKeycodeConverterData", "(", ")", "(", "map", "[", "string", "]", "[", "]", "string", ",", "error", ")", "{", "buf", ",", "err", ":=", "grab", "(", "keycodeConverterDataInc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", ...
// loadKeycodeConverterData loads the key codes from the keycode_converter_data.inc.
[ "loadKeycodeConverterData", "loads", "the", "key", "codes", "from", "the", "keycode_converter_data", ".", "inc", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L156-L174
134,531
chromedp/chromedp
kb/gen.go
getCode
func getCode(s string) string { if !strings.HasPrefix(s, `"`) || !strings.HasSuffix(s, `"`) { panic(fmt.Sprintf("expected string, got: %s", s)) } return s[1 : len(s)-1] }
go
func getCode(s string) string { if !strings.HasPrefix(s, `"`) || !strings.HasSuffix(s, `"`) { panic(fmt.Sprintf("expected string, got: %s", s)) } return s[1 : len(s)-1] }
[ "func", "getCode", "(", "s", "string", ")", "string", "{", "if", "!", "strings", ".", "HasPrefix", "(", "s", ",", "`\"`", ")", "||", "!", "strings", ".", "HasSuffix", "(", "s", ",", "`\"`", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\""...
// getCode is a simple wrapper around parsing the code definition.
[ "getCode", "is", "a", "simple", "wrapper", "around", "parsing", "the", "code", "definition", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L206-L212
134,532
chromedp/chromedp
kb/gen.go
addKey
func addKey(keys map[rune]kb.Key, r rune, key kb.Key, scanCodeMap map[string][]int64, shouldPanic bool) { if _, ok := keys[r]; ok { if shouldPanic { panic(fmt.Sprintf("rune %U (%s/%s) already defined in keys", r, key.Code, key.Key)) } return } sc, ok := scanCodeMap[key.Code] if ok { key.Native = sc[0] ...
go
func addKey(keys map[rune]kb.Key, r rune, key kb.Key, scanCodeMap map[string][]int64, shouldPanic bool) { if _, ok := keys[r]; ok { if shouldPanic { panic(fmt.Sprintf("rune %U (%s/%s) already defined in keys", r, key.Code, key.Key)) } return } sc, ok := scanCodeMap[key.Code] if ok { key.Native = sc[0] ...
[ "func", "addKey", "(", "keys", "map", "[", "rune", "]", "kb", ".", "Key", ",", "r", "rune", ",", "key", "kb", ".", "Key", ",", "scanCodeMap", "map", "[", "string", "]", "[", "]", "int64", ",", "shouldPanic", "bool", ")", "{", "if", "_", ",", "o...
// addKey is a simple map add wrapper to panic if the key is already defined, // and to lookup the correct scan code.
[ "addKey", "is", "a", "simple", "map", "add", "wrapper", "to", "panic", "if", "the", "key", "is", "already", "defined", "and", "to", "lookup", "the", "correct", "scan", "code", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L216-L231
134,533
chromedp/chromedp
kb/gen.go
loadPrintable
func loadPrintable(keys map[rune]kb.Key, keycodeConverterMap, domKeyMap map[string][]string, layoutBuf []byte, scanCodeMap map[string][]int64) error { buf := extract(layoutBuf, "kPrintableCodeMap") matches := printableKeyRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches { domCode := m[1] // i...
go
func loadPrintable(keys map[rune]kb.Key, keycodeConverterMap, domKeyMap map[string][]string, layoutBuf []byte, scanCodeMap map[string][]int64) error { buf := extract(layoutBuf, "kPrintableCodeMap") matches := printableKeyRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches { domCode := m[1] // i...
[ "func", "loadPrintable", "(", "keys", "map", "[", "rune", "]", "kb", ".", "Key", ",", "keycodeConverterMap", ",", "domKeyMap", "map", "[", "string", "]", "[", "]", "string", ",", "layoutBuf", "[", "]", "byte", ",", "scanCodeMap", "map", "[", "string", ...
// loadPrintable loads the printable key definitions.
[ "loadPrintable", "loads", "the", "printable", "key", "definitions", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L236-L283
134,534
chromedp/chromedp
kb/gen.go
loadDomKeyData
func loadDomKeyData() (map[string][]string, error) { buf, err := grab(domKeyDataInc) if err != nil { return nil, err } buf = fixRE.ReplaceAllLiteral(buf, []byte(", ")) keyMap := make(map[string][]string) matches := domKeyRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches { keyMap[m[2]] = m[...
go
func loadDomKeyData() (map[string][]string, error) { buf, err := grab(domKeyDataInc) if err != nil { return nil, err } buf = fixRE.ReplaceAllLiteral(buf, []byte(", ")) keyMap := make(map[string][]string) matches := domKeyRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches { keyMap[m[2]] = m[...
[ "func", "loadDomKeyData", "(", ")", "(", "map", "[", "string", "]", "[", "]", "string", ",", "error", ")", "{", "buf", ",", "err", ":=", "grab", "(", "domKeyDataInc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}...
// loadDomKeyData loads the dom key data definitions.
[ "loadDomKeyData", "loads", "the", "dom", "key", "data", "definitions", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L288-L302
134,535
chromedp/chromedp
kb/gen.go
loadNonPrintable
func loadNonPrintable(keys map[rune]kb.Key, keycodeConverterMap, domKeyMap map[string][]string, layoutBuf []byte, scanCodeMap map[string][]int64) error { buf := extract(layoutBuf, "kNonPrintableCodeMap") matches := nonPrintableKeyRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches { code, key := m[...
go
func loadNonPrintable(keys map[rune]kb.Key, keycodeConverterMap, domKeyMap map[string][]string, layoutBuf []byte, scanCodeMap map[string][]int64) error { buf := extract(layoutBuf, "kNonPrintableCodeMap") matches := nonPrintableKeyRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches { code, key := m[...
[ "func", "loadNonPrintable", "(", "keys", "map", "[", "rune", "]", "kb", ".", "Key", ",", "keycodeConverterMap", ",", "domKeyMap", "map", "[", "string", "]", "[", "]", "string", ",", "layoutBuf", "[", "]", "byte", ",", "scanCodeMap", "map", "[", "string",...
// loadNonPrintable loads the not printable key definitions.
[ "loadNonPrintable", "loads", "the", "not", "printable", "key", "definitions", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L307-L342
134,536
chromedp/chromedp
kb/gen.go
processKeys
func processKeys(keys map[rune]kb.Key) ([]byte, []byte, error) { // order rune keys idx := make([]rune, len(keys)) var i int for c := range keys { idx[i] = c i++ } sort.Slice(idx, func(a, b int) bool { return idx[a] < idx[b] }) // process var constBuf, mapBuf bytes.Buffer for _, c := range idx { key ...
go
func processKeys(keys map[rune]kb.Key) ([]byte, []byte, error) { // order rune keys idx := make([]rune, len(keys)) var i int for c := range keys { idx[i] = c i++ } sort.Slice(idx, func(a, b int) bool { return idx[a] < idx[b] }) // process var constBuf, mapBuf bytes.Buffer for _, c := range idx { key ...
[ "func", "processKeys", "(", "keys", "map", "[", "rune", "]", "kb", ".", "Key", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ",", "error", ")", "{", "// order rune keys", "idx", ":=", "make", "(", "[", "]", "rune", ",", "len", "(", "keys", ...
// processKeys processes the generated keys.
[ "processKeys", "processes", "the", "generated", "keys", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L347-L394
134,537
chromedp/chromedp
kb/gen.go
loadScanCodes
func loadScanCodes(keycodeConverterMap, domKeyMap map[string][]string, layoutBuf []byte) (map[string][]int64, error) { vkeyCodeMap, err := loadPosixWinKeyboardCodes() if err != nil { return nil, err } buf := extract(layoutBuf, "kDomCodeToKeyboardCodeMap") buf = domCodeVkeyFixRE.ReplaceAllLiteral(buf, []byte(", ...
go
func loadScanCodes(keycodeConverterMap, domKeyMap map[string][]string, layoutBuf []byte) (map[string][]int64, error) { vkeyCodeMap, err := loadPosixWinKeyboardCodes() if err != nil { return nil, err } buf := extract(layoutBuf, "kDomCodeToKeyboardCodeMap") buf = domCodeVkeyFixRE.ReplaceAllLiteral(buf, []byte(", ...
[ "func", "loadScanCodes", "(", "keycodeConverterMap", ",", "domKeyMap", "map", "[", "string", "]", "[", "]", "string", ",", "layoutBuf", "[", "]", "byte", ")", "(", "map", "[", "string", "]", "[", "]", "int64", ",", "error", ")", "{", "vkeyCodeMap", ","...
// loadScanCodes loads the scan codes for the dom key definitions.
[ "loadScanCodes", "loads", "the", "scan", "codes", "for", "the", "dom", "key", "definitions", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L400-L428
134,538
chromedp/chromedp
kb/gen.go
loadPosixWinKeyboardCodes
func loadPosixWinKeyboardCodes() (map[string][]int64, error) { lookup := map[string]string{ // mac alias "VKEY_LWIN": "0x5B", // no idea where these are defined in chromium code base (assuming in // windows headers) // // manually added here as pulled from various online docs "VK_CANCEL": "0x03", ...
go
func loadPosixWinKeyboardCodes() (map[string][]int64, error) { lookup := map[string]string{ // mac alias "VKEY_LWIN": "0x5B", // no idea where these are defined in chromium code base (assuming in // windows headers) // // manually added here as pulled from various online docs "VK_CANCEL": "0x03", ...
[ "func", "loadPosixWinKeyboardCodes", "(", ")", "(", "map", "[", "string", "]", "[", "]", "int64", ",", "error", ")", "{", "lookup", ":=", "map", "[", "string", "]", "string", "{", "// mac alias", "\"", "\"", ":", "\"", "\"", ",", "// no idea where these ...
// loadPosixWinKeyboardCodes loads the native and windows keyboard scan codes // mapped to the DOM key.
[ "loadPosixWinKeyboardCodes", "loads", "the", "native", "and", "windows", "keyboard", "scan", "codes", "mapped", "to", "the", "DOM", "key", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L434-L476
134,539
chromedp/chromedp
kb/gen.go
loadKeyboardCodes
func loadKeyboardCodes(vkeyCodeMap map[string][]int64, lookup map[string]string, path string, pos int) error { buf, err := grab(path) if err != nil { return err } buf = extract(buf, "KeyboardCode") matches := keyboardCodeRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches { v := m[2] switch...
go
func loadKeyboardCodes(vkeyCodeMap map[string][]int64, lookup map[string]string, path string, pos int) error { buf, err := grab(path) if err != nil { return err } buf = extract(buf, "KeyboardCode") matches := keyboardCodeRE.FindAllStringSubmatch(string(buf), -1) for _, m := range matches { v := m[2] switch...
[ "func", "loadKeyboardCodes", "(", "vkeyCodeMap", "map", "[", "string", "]", "[", "]", "int64", ",", "lookup", "map", "[", "string", "]", "string", ",", "path", "string", ",", "pos", "int", ")", "error", "{", "buf", ",", "err", ":=", "grab", "(", "pat...
// loadKeyboardCodes loads the enum definition from the specified path, saving // the resolved symbol value to the specified position for the resulting dom // key name in the vkeyCodeMap.
[ "loadKeyboardCodes", "loads", "the", "enum", "definition", "from", "the", "specified", "path", "saving", "the", "resolved", "symbol", "value", "to", "the", "specified", "position", "for", "the", "resulting", "dom", "key", "name", "in", "the", "vkeyCodeMap", "." ...
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L483-L520
134,540
chromedp/chromedp
kb/gen.go
extract
func extract(buf []byte, name string) []byte { extractRE := regexp.MustCompile(`\s+` + name + `.+?{`) buf = buf[extractRE.FindIndex(buf)[0]:] return buf[:endRE.FindIndex(buf)[1]] }
go
func extract(buf []byte, name string) []byte { extractRE := regexp.MustCompile(`\s+` + name + `.+?{`) buf = buf[extractRE.FindIndex(buf)[0]:] return buf[:endRE.FindIndex(buf)[1]] }
[ "func", "extract", "(", "buf", "[", "]", "byte", ",", "name", "string", ")", "[", "]", "byte", "{", "extractRE", ":=", "regexp", ".", "MustCompile", "(", "`\\s+`", "+", "name", "+", "`.+?{`", ")", "\n", "buf", "=", "buf", "[", "extractRE", ".", "Fi...
// extract extracts a block of next from a block of c++ code.
[ "extract", "extracts", "a", "block", "of", "next", "from", "a", "block", "of", "c", "++", "code", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L525-L529
134,541
chromedp/chromedp
kb/gen.go
grab
func grab(path string) ([]byte, error) { res, err := http.Get(path) if err != nil { return nil, err } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { return nil, err } buf, err := base64.StdEncoding.DecodeString(string(body)) if err != nil { return nil, err } return buf,...
go
func grab(path string) ([]byte, error) { res, err := http.Get(path) if err != nil { return nil, err } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { return nil, err } buf, err := base64.StdEncoding.DecodeString(string(body)) if err != nil { return nil, err } return buf,...
[ "func", "grab", "(", "path", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "res", ",", "err", ":=", "http", ".", "Get", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defe...
// grab retrieves a file from the chromium source code.
[ "grab", "retrieves", "a", "file", "from", "the", "chromium", "source", "code", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/kb/gen.go#L532-L550
134,542
chromedp/chromedp
query.go
Nodes
func Nodes(sel interface{}, nodes *[]*cdp.Node, opts ...QueryOption) Action { if nodes == nil { panic("nodes cannot be nil") } return QueryAfter(sel, func(ctx context.Context, n ...*cdp.Node) error { *nodes = n return nil }, opts...) }
go
func Nodes(sel interface{}, nodes *[]*cdp.Node, opts ...QueryOption) Action { if nodes == nil { panic("nodes cannot be nil") } return QueryAfter(sel, func(ctx context.Context, n ...*cdp.Node) error { *nodes = n return nil }, opts...) }
[ "func", "Nodes", "(", "sel", "interface", "{", "}", ",", "nodes", "*", "[", "]", "*", "cdp", ".", "Node", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "nodes", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", ...
// Nodes retrieves the document nodes matching the selector.
[ "Nodes", "retrieves", "the", "document", "nodes", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L23-L32
134,543
chromedp/chromedp
query.go
NodeIDs
func NodeIDs(sel interface{}, ids *[]cdp.NodeID, opts ...QueryOption) Action { if ids == nil { panic("nodes cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { nodeIDs := make([]cdp.NodeID, len(nodes)) for i, n := range nodes { nodeIDs[i] = n.NodeID } *ids = ...
go
func NodeIDs(sel interface{}, ids *[]cdp.NodeID, opts ...QueryOption) Action { if ids == nil { panic("nodes cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { nodeIDs := make([]cdp.NodeID, len(nodes)) for i, n := range nodes { nodeIDs[i] = n.NodeID } *ids = ...
[ "func", "NodeIDs", "(", "sel", "interface", "{", "}", ",", "ids", "*", "[", "]", "cdp", ".", "NodeID", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "ids", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return...
// NodeIDs retrieves the node IDs matching the selector.
[ "NodeIDs", "retrieves", "the", "node", "IDs", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L35-L50
134,544
chromedp/chromedp
query.go
Focus
func Focus(sel interface{}, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } return dom.Focus().WithNodeID(nodes[0].NodeID).Do(ctx) }, opts...) }
go
func Focus(sel interface{}, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } return dom.Focus().WithNodeID(nodes[0].NodeID).Do(ctx) }, opts...) }
[ "func", "Focus", "(", "sel", "interface", "{", "}", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "QueryAfter", "(", "sel", ",", "func", "(", "ctx", "context", ".", "Context", ",", "nodes", "...", "*", "cdp", ".", "Node", ")", "err...
// Focus focuses the first node matching the selector.
[ "Focus", "focuses", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L53-L61
134,545
chromedp/chromedp
query.go
Dimensions
func Dimensions(sel interface{}, model **dom.BoxModel, opts ...QueryOption) Action { if model == nil { panic("model cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } var err ...
go
func Dimensions(sel interface{}, model **dom.BoxModel, opts ...QueryOption) Action { if model == nil { panic("model cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } var err ...
[ "func", "Dimensions", "(", "sel", "interface", "{", "}", ",", "model", "*", "*", "dom", ".", "BoxModel", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "model", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return...
// Dimensions retrieves the box model dimensions for the first node matching // the selector.
[ "Dimensions", "retrieves", "the", "box", "model", "dimensions", "for", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L86-L98
134,546
chromedp/chromedp
query.go
Text
func Text(sel interface{}, text *string, opts ...QueryOption) Action { if text == nil { panic("text cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } return EvaluateAsDevTo...
go
func Text(sel interface{}, text *string, opts ...QueryOption) Action { if text == nil { panic("text cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } return EvaluateAsDevTo...
[ "func", "Text", "(", "sel", "interface", "{", "}", ",", "text", "*", "string", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "text", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "QueryAfter", "(", "se...
// Text retrieves the visible text of the first node matching the selector.
[ "Text", "retrieves", "the", "visible", "text", "of", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L101-L113
134,547
chromedp/chromedp
query.go
Value
func Value(sel interface{}, value *string, opts ...QueryOption) Action { if value == nil { panic("value cannot be nil") } return JavascriptAttribute(sel, "value", value, opts...) }
go
func Value(sel interface{}, value *string, opts ...QueryOption) Action { if value == nil { panic("value cannot be nil") } return JavascriptAttribute(sel, "value", value, opts...) }
[ "func", "Value", "(", "sel", "interface", "{", "}", ",", "value", "*", "string", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "value", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "JavascriptAttribute", ...
// Value retrieves the value of the first node matching the selector.
[ "Value", "retrieves", "the", "value", "of", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L173-L179
134,548
chromedp/chromedp
query.go
SetValue
func SetValue(sel interface{}, value string, opts ...QueryOption) Action { return SetJavascriptAttribute(sel, "value", value, opts...) }
go
func SetValue(sel interface{}, value string, opts ...QueryOption) Action { return SetJavascriptAttribute(sel, "value", value, opts...) }
[ "func", "SetValue", "(", "sel", "interface", "{", "}", ",", "value", "string", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "SetJavascriptAttribute", "(", "sel", ",", "\"", "\"", ",", "value", ",", "opts", "...", ")", "\n", "}" ]
// SetValue sets the value of an element.
[ "SetValue", "sets", "the", "value", "of", "an", "element", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L182-L184
134,549
chromedp/chromedp
query.go
Attributes
func Attributes(sel interface{}, attributes *map[string]string, opts ...QueryOption) Action { if attributes == nil { panic("attributes cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes",...
go
func Attributes(sel interface{}, attributes *map[string]string, opts ...QueryOption) Action { if attributes == nil { panic("attributes cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes",...
[ "func", "Attributes", "(", "sel", "interface", "{", "}", ",", "attributes", "*", "map", "[", "string", "]", "string", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "attributes", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}...
// Attributes retrieves the element attributes for the first node matching the // selector.
[ "Attributes", "retrieves", "the", "element", "attributes", "for", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L188-L211
134,550
chromedp/chromedp
query.go
SetAttributes
func SetAttributes(sel interface{}, attributes map[string]string, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return errors.New("expected at least one element") } i, attrs := 0, make([]string, len(attributes)) for k, v := ra...
go
func SetAttributes(sel interface{}, attributes map[string]string, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return errors.New("expected at least one element") } i, attrs := 0, make([]string, len(attributes)) for k, v := ra...
[ "func", "SetAttributes", "(", "sel", "interface", "{", "}", ",", "attributes", "map", "[", "string", "]", "string", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "QueryAfter", "(", "sel", ",", "func", "(", "ctx", "context", ".", "Conte...
// SetAttributes sets the element attributes for the first node matching the // selector.
[ "SetAttributes", "sets", "the", "element", "attributes", "for", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L245-L259
134,551
chromedp/chromedp
query.go
AttributeValue
func AttributeValue(sel interface{}, name string, value *string, ok *bool, opts ...QueryOption) Action { if value == nil { panic("value cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return errors.New("expected at least one element") } ...
go
func AttributeValue(sel interface{}, name string, value *string, ok *bool, opts ...QueryOption) Action { if value == nil { panic("value cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return errors.New("expected at least one element") } ...
[ "func", "AttributeValue", "(", "sel", "interface", "{", "}", ",", "name", "string", ",", "value", "*", "string", ",", "ok", "*", "bool", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "value", "==", "nil", "{", "panic", "(", "\"", "\"",...
// AttributeValue retrieves the element attribute value for the first node // matching the selector.
[ "AttributeValue", "retrieves", "the", "element", "attribute", "value", "for", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L263-L293
134,552
chromedp/chromedp
query.go
SetAttributeValue
func SetAttributeValue(sel interface{}, name, value string, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } return dom.SetAttributeValue(nodes[0].NodeID, name, val...
go
func SetAttributeValue(sel interface{}, name, value string, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } return dom.SetAttributeValue(nodes[0].NodeID, name, val...
[ "func", "SetAttributeValue", "(", "sel", "interface", "{", "}", ",", "name", ",", "value", "string", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "QueryAfter", "(", "sel", ",", "func", "(", "ctx", "context", ".", "Context", ",", "node...
// SetAttributeValue sets the element attribute with name to value for the // first node matching the selector.
[ "SetAttributeValue", "sets", "the", "element", "attribute", "with", "name", "to", "value", "for", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L297-L305
134,553
chromedp/chromedp
query.go
JavascriptAttribute
func JavascriptAttribute(sel interface{}, name string, res interface{}, opts ...QueryOption) Action { if res == nil { panic("res cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) ...
go
func JavascriptAttribute(sel interface{}, name string, res interface{}, opts ...QueryOption) Action { if res == nil { panic("res cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) ...
[ "func", "JavascriptAttribute", "(", "sel", "interface", "{", "}", ",", "name", "string", ",", "res", "interface", "{", "}", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "res", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}"...
// JavascriptAttribute retrieves the Javascript attribute for the first node // matching the selector.
[ "JavascriptAttribute", "retrieves", "the", "Javascript", "attribute", "for", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L321-L332
134,554
chromedp/chromedp
query.go
SetJavascriptAttribute
func SetJavascriptAttribute(sel interface{}, name, value string, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } var res string err := EvaluateAsDevTools(fmt.Spr...
go
func SetJavascriptAttribute(sel interface{}, name, value string, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } var res string err := EvaluateAsDevTools(fmt.Spr...
[ "func", "SetJavascriptAttribute", "(", "sel", "interface", "{", "}", ",", "name", ",", "value", "string", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "QueryAfter", "(", "sel", ",", "func", "(", "ctx", "context", ".", "Context", ",", ...
// SetJavascriptAttribute sets the javascript attribute for the first node // matching the selector.
[ "SetJavascriptAttribute", "sets", "the", "javascript", "attribute", "for", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L336-L353
134,555
chromedp/chromedp
query.go
OuterHTML
func OuterHTML(sel interface{}, html *string, opts ...QueryOption) Action { if html == nil { panic("html cannot be nil") } return JavascriptAttribute(sel, "outerHTML", html, opts...) }
go
func OuterHTML(sel interface{}, html *string, opts ...QueryOption) Action { if html == nil { panic("html cannot be nil") } return JavascriptAttribute(sel, "outerHTML", html, opts...) }
[ "func", "OuterHTML", "(", "sel", "interface", "{", "}", ",", "html", "*", "string", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "html", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "JavascriptAttribute", ...
// OuterHTML retrieves the outer html of the first node matching the selector.
[ "OuterHTML", "retrieves", "the", "outer", "html", "of", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L356-L361
134,556
chromedp/chromedp
query.go
Click
func Click(sel interface{}, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } return MouseClickNode(nodes[0]).Do(ctx) }, append(opts, NodeVisible)...) }
go
func Click(sel interface{}, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } return MouseClickNode(nodes[0]).Do(ctx) }, append(opts, NodeVisible)...) }
[ "func", "Click", "(", "sel", "interface", "{", "}", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "QueryAfter", "(", "sel", ",", "func", "(", "ctx", "context", ".", "Context", ",", "nodes", "...", "*", "cdp", ".", "Node", ")", "err...
// Click sends a mouse click event to the first node matching the selector.
[ "Click", "sends", "a", "mouse", "click", "event", "to", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L372-L380
134,557
chromedp/chromedp
query.go
Screenshot
func Screenshot(sel interface{}, picbuf *[]byte, opts ...QueryOption) Action { if picbuf == nil { panic("picbuf cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } // get box...
go
func Screenshot(sel interface{}, picbuf *[]byte, opts ...QueryOption) Action { if picbuf == nil { panic("picbuf cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } // get box...
[ "func", "Screenshot", "(", "sel", "interface", "{", "}", ",", "picbuf", "*", "[", "]", "byte", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "picbuf", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "Que...
// Screenshot takes a screenshot of the first node matching the selector.
[ "Screenshot", "takes", "a", "screenshot", "of", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L439-L495
134,558
chromedp/chromedp
query.go
Reset
func Reset(sel interface{}, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } var res bool err := EvaluateAsDevTools(fmt.Sprintf(resetJS, nodes[0].FullXPath()), &r...
go
func Reset(sel interface{}, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } var res bool err := EvaluateAsDevTools(fmt.Sprintf(resetJS, nodes[0].FullXPath()), &r...
[ "func", "Reset", "(", "sel", "interface", "{", "}", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "QueryAfter", "(", "sel", ",", "func", "(", "ctx", "context", ".", "Context", ",", "nodes", "...", "*", "cdp", ".", "Node", ")", "err...
// Reset is an action that resets the form of the first node matching the // selector belongs to.
[ "Reset", "is", "an", "action", "that", "resets", "the", "form", "of", "the", "first", "node", "matching", "the", "selector", "belongs", "to", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L521-L539
134,559
chromedp/chromedp
query.go
ComputedStyle
func ComputedStyle(sel interface{}, style *[]*css.ComputedProperty, opts ...QueryOption) Action { if style == nil { panic("style cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) ...
go
func ComputedStyle(sel interface{}, style *[]*css.ComputedProperty, opts ...QueryOption) Action { if style == nil { panic("style cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) ...
[ "func", "ComputedStyle", "(", "sel", "interface", "{", "}", ",", "style", "*", "[", "]", "*", "css", ".", "ComputedProperty", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "style", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n",...
// ComputedStyle retrieves the computed style of the first node matching the selector.
[ "ComputedStyle", "retrieves", "the", "computed", "style", "of", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L542-L561
134,560
chromedp/chromedp
query.go
MatchedStyle
func MatchedStyle(sel interface{}, style **css.GetMatchedStylesForNodeReturns, opts ...QueryOption) Action { if style == nil { panic("style cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any no...
go
func MatchedStyle(sel interface{}, style **css.GetMatchedStylesForNodeReturns, opts ...QueryOption) Action { if style == nil { panic("style cannot be nil") } return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any no...
[ "func", "MatchedStyle", "(", "sel", "interface", "{", "}", ",", "style", "*", "*", "css", ".", "GetMatchedStylesForNodeReturns", ",", "opts", "...", "QueryOption", ")", "Action", "{", "if", "style", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", ...
// MatchedStyle retrieves the matched style information for the first node // matching the selector.
[ "MatchedStyle", "retrieves", "the", "matched", "style", "information", "for", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L565-L588
134,561
chromedp/chromedp
query.go
ScrollIntoView
func ScrollIntoView(sel interface{}, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } var pos []int err := EvaluateAsDevTools(fmt.Sprintf(scrollIntoViewJS, nodes[...
go
func ScrollIntoView(sel interface{}, opts ...QueryOption) Action { return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector `%s` did not return any nodes", sel) } var pos []int err := EvaluateAsDevTools(fmt.Sprintf(scrollIntoViewJS, nodes[...
[ "func", "ScrollIntoView", "(", "sel", "interface", "{", "}", ",", "opts", "...", "QueryOption", ")", "Action", "{", "return", "QueryAfter", "(", "sel", ",", "func", "(", "ctx", "context", ".", "Context", ",", "nodes", "...", "*", "cdp", ".", "Node", ")...
// ScrollIntoView scrolls the window to the first node matching the selector.
[ "ScrollIntoView", "scrolls", "the", "window", "to", "the", "first", "node", "matching", "the", "selector", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/query.go#L591-L609
134,562
chromedp/chromedp
target.go
documentUpdated
func (t *Target) documentUpdated(ctx context.Context) { f := t.cur f.Lock() defer f.Unlock() // invalidate nodes if f.Root != nil { close(f.Root.Invalidated) } f.Nodes = make(map[cdp.NodeID]*cdp.Node) var err error f.Root, err = dom.GetDocument().WithPierce(true).Do(cdp.WithExecutor(ctx, t)) if err == con...
go
func (t *Target) documentUpdated(ctx context.Context) { f := t.cur f.Lock() defer f.Unlock() // invalidate nodes if f.Root != nil { close(f.Root.Invalidated) } f.Nodes = make(map[cdp.NodeID]*cdp.Node) var err error f.Root, err = dom.GetDocument().WithPierce(true).Do(cdp.WithExecutor(ctx, t)) if err == con...
[ "func", "(", "t", "*", "Target", ")", "documentUpdated", "(", "ctx", "context", ".", "Context", ")", "{", "f", ":=", "t", ".", "cur", "\n", "f", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "Unlock", "(", ")", "\n\n", "// invalidate nodes", "if"...
// documentUpdated handles the document updated event, retrieving the document // root for the root frame.
[ "documentUpdated", "handles", "the", "document", "updated", "event", "retrieving", "the", "document", "root", "for", "the", "root", "frame", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/target.go#L168-L190
134,563
chromedp/chromedp
target.go
pageEvent
func (t *Target) pageEvent(ev interface{}) { var id cdp.FrameID var op frameOp switch e := ev.(type) { case *page.EventFrameNavigated: t.frames[e.Frame.ID] = e.Frame if e.Frame.ParentID == "" { // This frame is only the new top-level frame if it has // no parent. t.cur = e.Frame } return case *p...
go
func (t *Target) pageEvent(ev interface{}) { var id cdp.FrameID var op frameOp switch e := ev.(type) { case *page.EventFrameNavigated: t.frames[e.Frame.ID] = e.Frame if e.Frame.ParentID == "" { // This frame is only the new top-level frame if it has // no parent. t.cur = e.Frame } return case *p...
[ "func", "(", "t", "*", "Target", ")", "pageEvent", "(", "ev", "interface", "{", "}", ")", "{", "var", "id", "cdp", ".", "FrameID", "\n", "var", "op", "frameOp", "\n\n", "switch", "e", ":=", "ev", ".", "(", "type", ")", "{", "case", "*", "page", ...
// pageEvent handles incoming page events.
[ "pageEvent", "handles", "incoming", "page", "events", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/target.go#L196-L257
134,564
chromedp/chromedp
target.go
domEvent
func (t *Target) domEvent(ctx context.Context, ev interface{}) { f := t.cur var id cdp.NodeID var op nodeOp switch e := ev.(type) { case *dom.EventDocumentUpdated: t.documentUpdated(ctx) return case *dom.EventSetChildNodes: id, op = e.ParentID, setChildNodes(f.Nodes, e.Nodes) case *dom.EventAttributeMod...
go
func (t *Target) domEvent(ctx context.Context, ev interface{}) { f := t.cur var id cdp.NodeID var op nodeOp switch e := ev.(type) { case *dom.EventDocumentUpdated: t.documentUpdated(ctx) return case *dom.EventSetChildNodes: id, op = e.ParentID, setChildNodes(f.Nodes, e.Nodes) case *dom.EventAttributeMod...
[ "func", "(", "t", "*", "Target", ")", "domEvent", "(", "ctx", "context", ".", "Context", ",", "ev", "interface", "{", "}", ")", "{", "f", ":=", "t", ".", "cur", "\n", "var", "id", "cdp", ".", "NodeID", "\n", "var", "op", "nodeOp", "\n\n", "switch...
// domEvent handles incoming DOM events.
[ "domEvent", "handles", "incoming", "DOM", "events", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/target.go#L260-L327
134,565
chromedp/chromedp
input.go
MouseAction
func MouseAction(typ input.MouseType, x, y int64, opts ...MouseOption) Action { me := input.DispatchMouseEvent(typ, float64(x), float64(y)) // apply opts for _, o := range opts { me = o(me) } return me }
go
func MouseAction(typ input.MouseType, x, y int64, opts ...MouseOption) Action { me := input.DispatchMouseEvent(typ, float64(x), float64(y)) // apply opts for _, o := range opts { me = o(me) } return me }
[ "func", "MouseAction", "(", "typ", "input", ".", "MouseType", ",", "x", ",", "y", "int64", ",", "opts", "...", "MouseOption", ")", "Action", "{", "me", ":=", "input", ".", "DispatchMouseEvent", "(", "typ", ",", "float64", "(", "x", ")", ",", "float64",...
// MouseAction is a mouse action.
[ "MouseAction", "is", "a", "mouse", "action", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L15-L24
134,566
chromedp/chromedp
input.go
MouseClickNode
func MouseClickNode(n *cdp.Node, opts ...MouseOption) Action { return ActionFunc(func(ctx context.Context) error { var pos []int err := EvaluateAsDevTools(fmt.Sprintf(scrollIntoViewJS, n.FullXPath()), &pos).Do(ctx) if err != nil { return err } box, err := dom.GetBoxModel().WithNodeID(n.NodeID).Do(ctx) ...
go
func MouseClickNode(n *cdp.Node, opts ...MouseOption) Action { return ActionFunc(func(ctx context.Context) error { var pos []int err := EvaluateAsDevTools(fmt.Sprintf(scrollIntoViewJS, n.FullXPath()), &pos).Do(ctx) if err != nil { return err } box, err := dom.GetBoxModel().WithNodeID(n.NodeID).Do(ctx) ...
[ "func", "MouseClickNode", "(", "n", "*", "cdp", ".", "Node", ",", "opts", "...", "MouseOption", ")", "Action", "{", "return", "ActionFunc", "(", "func", "(", "ctx", "context", ".", "Context", ")", "error", "{", "var", "pos", "[", "]", "int", "\n", "e...
// MouseClickNode dispatches a mouse left button click event at the center of a // specified node. // // Note that the window will be scrolled if the node is not within the window's // viewport.
[ "MouseClickNode", "dispatches", "a", "mouse", "left", "button", "click", "event", "at", "the", "center", "of", "a", "specified", "node", ".", "Note", "that", "the", "window", "will", "be", "scrolled", "if", "the", "node", "is", "not", "within", "the", "win...
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L57-L85
134,567
chromedp/chromedp
input.go
ButtonType
func ButtonType(button input.ButtonType) MouseOption { return func(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithButton(button) } }
go
func ButtonType(button input.ButtonType) MouseOption { return func(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithButton(button) } }
[ "func", "ButtonType", "(", "button", "input", ".", "ButtonType", ")", "MouseOption", "{", "return", "func", "(", "p", "*", "input", ".", "DispatchMouseEventParams", ")", "*", "input", ".", "DispatchMouseEventParams", "{", "return", "p", ".", "WithButton", "(",...
// ButtonType is a mouse action option to set the button to click.
[ "ButtonType", "is", "a", "mouse", "action", "option", "to", "set", "the", "button", "to", "click", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L96-L100
134,568
chromedp/chromedp
input.go
ButtonLeft
func ButtonLeft(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithButton(input.ButtonLeft) }
go
func ButtonLeft(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithButton(input.ButtonLeft) }
[ "func", "ButtonLeft", "(", "p", "*", "input", ".", "DispatchMouseEventParams", ")", "*", "input", ".", "DispatchMouseEventParams", "{", "return", "p", ".", "WithButton", "(", "input", ".", "ButtonLeft", ")", "\n", "}" ]
// ButtonLeft is a mouse action option to set the button clicked as the left // mouse button.
[ "ButtonLeft", "is", "a", "mouse", "action", "option", "to", "set", "the", "button", "clicked", "as", "the", "left", "mouse", "button", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L104-L106
134,569
chromedp/chromedp
input.go
ButtonMiddle
func ButtonMiddle(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithButton(input.ButtonMiddle) }
go
func ButtonMiddle(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithButton(input.ButtonMiddle) }
[ "func", "ButtonMiddle", "(", "p", "*", "input", ".", "DispatchMouseEventParams", ")", "*", "input", ".", "DispatchMouseEventParams", "{", "return", "p", ".", "WithButton", "(", "input", ".", "ButtonMiddle", ")", "\n", "}" ]
// ButtonMiddle is a mouse action option to set the button clicked as the middle // mouse button.
[ "ButtonMiddle", "is", "a", "mouse", "action", "option", "to", "set", "the", "button", "clicked", "as", "the", "middle", "mouse", "button", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L110-L112
134,570
chromedp/chromedp
input.go
ButtonRight
func ButtonRight(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithButton(input.ButtonRight) }
go
func ButtonRight(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithButton(input.ButtonRight) }
[ "func", "ButtonRight", "(", "p", "*", "input", ".", "DispatchMouseEventParams", ")", "*", "input", ".", "DispatchMouseEventParams", "{", "return", "p", ".", "WithButton", "(", "input", ".", "ButtonRight", ")", "\n", "}" ]
// ButtonRight is a mouse action option to set the button clicked as the right // mouse button.
[ "ButtonRight", "is", "a", "mouse", "action", "option", "to", "set", "the", "button", "clicked", "as", "the", "right", "mouse", "button", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L116-L118
134,571
chromedp/chromedp
input.go
ButtonModifiers
func ButtonModifiers(modifiers ...input.Modifier) MouseOption { return func(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { for _, m := range modifiers { p.Modifiers |= m } return p } }
go
func ButtonModifiers(modifiers ...input.Modifier) MouseOption { return func(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { for _, m := range modifiers { p.Modifiers |= m } return p } }
[ "func", "ButtonModifiers", "(", "modifiers", "...", "input", ".", "Modifier", ")", "MouseOption", "{", "return", "func", "(", "p", "*", "input", ".", "DispatchMouseEventParams", ")", "*", "input", ".", "DispatchMouseEventParams", "{", "for", "_", ",", "m", "...
// ButtonModifiers is a mouse action option to add additional input modifiers // for a button click.
[ "ButtonModifiers", "is", "a", "mouse", "action", "option", "to", "add", "additional", "input", "modifiers", "for", "a", "button", "click", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L128-L135
134,572
chromedp/chromedp
input.go
ClickCount
func ClickCount(n int) MouseOption { return func(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithClickCount(int64(n)) } }
go
func ClickCount(n int) MouseOption { return func(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams { return p.WithClickCount(int64(n)) } }
[ "func", "ClickCount", "(", "n", "int", ")", "MouseOption", "{", "return", "func", "(", "p", "*", "input", ".", "DispatchMouseEventParams", ")", "*", "input", ".", "DispatchMouseEventParams", "{", "return", "p", ".", "WithClickCount", "(", "int64", "(", "n", ...
// ClickCount is a mouse action option to set the click count.
[ "ClickCount", "is", "a", "mouse", "action", "option", "to", "set", "the", "click", "count", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L138-L142
134,573
chromedp/chromedp
input.go
KeyActionNode
func KeyActionNode(n *cdp.Node, keys string, opts ...KeyOption) Action { return ActionFunc(func(ctx context.Context) error { err := dom.Focus().WithNodeID(n.NodeID).Do(ctx) if err != nil { return err } return KeyAction(keys, opts...).Do(ctx) }) }
go
func KeyActionNode(n *cdp.Node, keys string, opts ...KeyOption) Action { return ActionFunc(func(ctx context.Context) error { err := dom.Focus().WithNodeID(n.NodeID).Do(ctx) if err != nil { return err } return KeyAction(keys, opts...).Do(ctx) }) }
[ "func", "KeyActionNode", "(", "n", "*", "cdp", ".", "Node", ",", "keys", "string", ",", "opts", "...", "KeyOption", ")", "Action", "{", "return", "ActionFunc", "(", "func", "(", "ctx", "context", ".", "Context", ")", "error", "{", "err", ":=", "dom", ...
// KeyActionNode dispatches a key event on a node.
[ "KeyActionNode", "dispatches", "a", "key", "event", "on", "a", "node", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L166-L175
134,574
chromedp/chromedp
input.go
KeyModifiers
func KeyModifiers(modifiers ...input.Modifier) KeyOption { return func(p *input.DispatchKeyEventParams) *input.DispatchKeyEventParams { for _, m := range modifiers { p.Modifiers |= m } return p } }
go
func KeyModifiers(modifiers ...input.Modifier) KeyOption { return func(p *input.DispatchKeyEventParams) *input.DispatchKeyEventParams { for _, m := range modifiers { p.Modifiers |= m } return p } }
[ "func", "KeyModifiers", "(", "modifiers", "...", "input", ".", "Modifier", ")", "KeyOption", "{", "return", "func", "(", "p", "*", "input", ".", "DispatchKeyEventParams", ")", "*", "input", ".", "DispatchKeyEventParams", "{", "for", "_", ",", "m", ":=", "r...
// KeyModifiers is a key action option to add additional modifiers on the key // press.
[ "KeyModifiers", "is", "a", "key", "action", "option", "to", "add", "additional", "modifiers", "on", "the", "key", "press", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/input.go#L182-L189
134,575
chromedp/chromedp
browser.go
NewBrowser
func NewBrowser(ctx context.Context, urlstr string, opts ...BrowserOption) (*Browser, error) { b := &Browser{ LostConnection: make(chan struct{}), newTabQueue: make(chan *Target), delTabQueue: make(chan target.SessionID, 1), // Fit some jobs without blocking, to reduce blocking in // Execute. cmdQueue: m...
go
func NewBrowser(ctx context.Context, urlstr string, opts ...BrowserOption) (*Browser, error) { b := &Browser{ LostConnection: make(chan struct{}), newTabQueue: make(chan *Target), delTabQueue: make(chan target.SessionID, 1), // Fit some jobs without blocking, to reduce blocking in // Execute. cmdQueue: m...
[ "func", "NewBrowser", "(", "ctx", "context", ".", "Context", ",", "urlstr", "string", ",", "opts", "...", "BrowserOption", ")", "(", "*", "Browser", ",", "error", ")", "{", "b", ":=", "&", "Browser", "{", "LostConnection", ":", "make", "(", "chan", "st...
// NewBrowser creates a new browser.
[ "NewBrowser", "creates", "a", "new", "browser", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/browser.go#L90-L122
134,576
chromedp/chromedp
nav.go
Navigate
func Navigate(urlstr string) Action { return ActionFunc(func(ctx context.Context) error { _, _, _, err := page.Navigate(urlstr).Do(ctx) return err }) }
go
func Navigate(urlstr string) Action { return ActionFunc(func(ctx context.Context) error { _, _, _, err := page.Navigate(urlstr).Do(ctx) return err }) }
[ "func", "Navigate", "(", "urlstr", "string", ")", "Action", "{", "return", "ActionFunc", "(", "func", "(", "ctx", "context", ".", "Context", ")", "error", "{", "_", ",", "_", ",", "_", ",", "err", ":=", "page", ".", "Navigate", "(", "urlstr", ")", ...
// Navigate navigates the current frame.
[ "Navigate", "navigates", "the", "current", "frame", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/nav.go#L11-L16
134,577
chromedp/chromedp
nav.go
NavigationEntries
func NavigationEntries(currentIndex *int64, entries *[]*page.NavigationEntry) Action { if currentIndex == nil || entries == nil { panic("currentIndex and entries cannot be nil") } return ActionFunc(func(ctx context.Context) error { var err error *currentIndex, *entries, err = page.GetNavigationHistory().Do(ct...
go
func NavigationEntries(currentIndex *int64, entries *[]*page.NavigationEntry) Action { if currentIndex == nil || entries == nil { panic("currentIndex and entries cannot be nil") } return ActionFunc(func(ctx context.Context) error { var err error *currentIndex, *entries, err = page.GetNavigationHistory().Do(ct...
[ "func", "NavigationEntries", "(", "currentIndex", "*", "int64", ",", "entries", "*", "[", "]", "*", "page", ".", "NavigationEntry", ")", "Action", "{", "if", "currentIndex", "==", "nil", "||", "entries", "==", "nil", "{", "panic", "(", "\"", "\"", ")", ...
// NavigationEntries is an action to retrieve the page's navigation history // entries.
[ "NavigationEntries", "is", "an", "action", "to", "retrieve", "the", "page", "s", "navigation", "history", "entries", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/nav.go#L20-L30
134,578
chromedp/chromedp
nav.go
NavigateBack
func NavigateBack() Action { return ActionFunc(func(ctx context.Context) error { cur, entries, err := page.GetNavigationHistory().Do(ctx) if err != nil { return err } if cur <= 0 || cur > int64(len(entries)-1) { return errors.New("invalid navigation entry") } return page.NavigateToHistoryEntry(entr...
go
func NavigateBack() Action { return ActionFunc(func(ctx context.Context) error { cur, entries, err := page.GetNavigationHistory().Do(ctx) if err != nil { return err } if cur <= 0 || cur > int64(len(entries)-1) { return errors.New("invalid navigation entry") } return page.NavigateToHistoryEntry(entr...
[ "func", "NavigateBack", "(", ")", "Action", "{", "return", "ActionFunc", "(", "func", "(", "ctx", "context", ".", "Context", ")", "error", "{", "cur", ",", "entries", ",", "err", ":=", "page", ".", "GetNavigationHistory", "(", ")", ".", "Do", "(", "ctx...
// NavigateBack navigates the current frame backwards in its history.
[ "NavigateBack", "navigates", "the", "current", "frame", "backwards", "in", "its", "history", "." ]
d15a83b928250a6181ad5c2cd843b530a581fd2b
https://github.com/chromedp/chromedp/blob/d15a83b928250a6181ad5c2cd843b530a581fd2b/nav.go#L39-L52
134,579
argoproj/argo
workflow/controller/controller.go
NewWorkflowController
func NewWorkflowController( restConfig *rest.Config, kubeclientset kubernetes.Interface, wfclientset wfclientset.Interface, namespace, executorImage, executorImagePullPolicy, configMap string, ) *WorkflowController { wfc := WorkflowController{ restConfig: restConfig, kubeclientset: ...
go
func NewWorkflowController( restConfig *rest.Config, kubeclientset kubernetes.Interface, wfclientset wfclientset.Interface, namespace, executorImage, executorImagePullPolicy, configMap string, ) *WorkflowController { wfc := WorkflowController{ restConfig: restConfig, kubeclientset: ...
[ "func", "NewWorkflowController", "(", "restConfig", "*", "rest", ".", "Config", ",", "kubeclientset", "kubernetes", ".", "Interface", ",", "wfclientset", "wfclientset", ".", "Interface", ",", "namespace", ",", "executorImage", ",", "executorImagePullPolicy", ",", "c...
// NewWorkflowController instantiates a new WorkflowController
[ "NewWorkflowController", "instantiates", "a", "new", "WorkflowController" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/controller.go#L69-L92
134,580
argoproj/argo
workflow/controller/controller.go
MetricsServer
func (wfc *WorkflowController) MetricsServer(ctx context.Context) { if wfc.Config.MetricsConfig.Enabled { informer := util.NewWorkflowInformer(wfc.restConfig, wfc.Config.Namespace, workflowMetricsResyncPeriod, wfc.tweakWorkflowMetricslist) go informer.Run(ctx.Done()) registry := metrics.NewWorkflowRegistry(infor...
go
func (wfc *WorkflowController) MetricsServer(ctx context.Context) { if wfc.Config.MetricsConfig.Enabled { informer := util.NewWorkflowInformer(wfc.restConfig, wfc.Config.Namespace, workflowMetricsResyncPeriod, wfc.tweakWorkflowMetricslist) go informer.Run(ctx.Done()) registry := metrics.NewWorkflowRegistry(infor...
[ "func", "(", "wfc", "*", "WorkflowController", ")", "MetricsServer", "(", "ctx", "context", ".", "Context", ")", "{", "if", "wfc", ".", "Config", ".", "MetricsConfig", ".", "Enabled", "{", "informer", ":=", "util", ".", "NewWorkflowInformer", "(", "wfc", "...
// MetricsServer starts a prometheus metrics server if enabled in the configmap
[ "MetricsServer", "starts", "a", "prometheus", "metrics", "server", "if", "enabled", "in", "the", "configmap" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/controller.go#L95-L102
134,581
argoproj/argo
workflow/controller/controller.go
TelemetryServer
func (wfc *WorkflowController) TelemetryServer(ctx context.Context) { if wfc.Config.TelemetryConfig.Enabled { registry := metrics.NewTelemetryRegistry() metrics.RunServer(ctx, wfc.Config.TelemetryConfig, registry) } }
go
func (wfc *WorkflowController) TelemetryServer(ctx context.Context) { if wfc.Config.TelemetryConfig.Enabled { registry := metrics.NewTelemetryRegistry() metrics.RunServer(ctx, wfc.Config.TelemetryConfig, registry) } }
[ "func", "(", "wfc", "*", "WorkflowController", ")", "TelemetryServer", "(", "ctx", "context", ".", "Context", ")", "{", "if", "wfc", ".", "Config", ".", "TelemetryConfig", ".", "Enabled", "{", "registry", ":=", "metrics", ".", "NewTelemetryRegistry", "(", ")...
// TelemetryServer starts a prometheus telemetry server if enabled in the configmap
[ "TelemetryServer", "starts", "a", "prometheus", "telemetry", "server", "if", "enabled", "in", "the", "configmap" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/controller.go#L105-L110
134,582
argoproj/argo
workflow/controller/controller.go
RunTTLController
func (wfc *WorkflowController) RunTTLController(ctx context.Context) { ttlCtrl := ttlcontroller.NewController( wfc.restConfig, wfc.wfclientset, wfc.Config.Namespace, wfc.Config.InstanceID, ) err := ttlCtrl.Run(ctx.Done()) if err != nil { panic(err) } }
go
func (wfc *WorkflowController) RunTTLController(ctx context.Context) { ttlCtrl := ttlcontroller.NewController( wfc.restConfig, wfc.wfclientset, wfc.Config.Namespace, wfc.Config.InstanceID, ) err := ttlCtrl.Run(ctx.Done()) if err != nil { panic(err) } }
[ "func", "(", "wfc", "*", "WorkflowController", ")", "RunTTLController", "(", "ctx", "context", ".", "Context", ")", "{", "ttlCtrl", ":=", "ttlcontroller", ".", "NewController", "(", "wfc", ".", "restConfig", ",", "wfc", ".", "wfclientset", ",", "wfc", ".", ...
// RunTTLController runs the workflow TTL controller
[ "RunTTLController", "runs", "the", "workflow", "TTL", "controller" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/controller.go#L113-L124
134,583
argoproj/argo
workflow/controller/controller.go
Run
func (wfc *WorkflowController) Run(ctx context.Context, wfWorkers, podWorkers int) { defer wfc.wfQueue.ShutDown() defer wfc.podQueue.ShutDown() log.Infof("Workflow Controller (version: %s) starting", argo.GetVersion()) log.Infof("Workers: workflow: %d, pod: %d", wfWorkers, podWorkers) log.Info("Watch Workflow con...
go
func (wfc *WorkflowController) Run(ctx context.Context, wfWorkers, podWorkers int) { defer wfc.wfQueue.ShutDown() defer wfc.podQueue.ShutDown() log.Infof("Workflow Controller (version: %s) starting", argo.GetVersion()) log.Infof("Workers: workflow: %d, pod: %d", wfWorkers, podWorkers) log.Info("Watch Workflow con...
[ "func", "(", "wfc", "*", "WorkflowController", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "wfWorkers", ",", "podWorkers", "int", ")", "{", "defer", "wfc", ".", "wfQueue", ".", "ShutDown", "(", ")", "\n", "defer", "wfc", ".", "podQueue", "....
// Run starts an Workflow resource controller
[ "Run", "starts", "an", "Workflow", "resource", "controller" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/controller.go#L127-L164
134,584
argoproj/argo
workflow/controller/controller.go
podLabeler
func (wfc *WorkflowController) podLabeler(stopCh <-chan struct{}) { for { select { case <-stopCh: return case pod := <-wfc.completedPods: parts := strings.Split(pod, "/") if len(parts) != 2 { log.Warnf("Unexpected item on completed pod channel: %s", pod) continue } namespace := parts[0] ...
go
func (wfc *WorkflowController) podLabeler(stopCh <-chan struct{}) { for { select { case <-stopCh: return case pod := <-wfc.completedPods: parts := strings.Split(pod, "/") if len(parts) != 2 { log.Warnf("Unexpected item on completed pod channel: %s", pod) continue } namespace := parts[0] ...
[ "func", "(", "wfc", "*", "WorkflowController", ")", "podLabeler", "(", "stopCh", "<-", "chan", "struct", "{", "}", ")", "{", "for", "{", "select", "{", "case", "<-", "stopCh", ":", "return", "\n", "case", "pod", ":=", "<-", "wfc", ".", "completedPods",...
// podLabeler will label all pods on the controllers completedPod channel as completed
[ "podLabeler", "will", "label", "all", "pods", "on", "the", "controllers", "completedPod", "channel", "as", "completed" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/controller.go#L167-L190
134,585
argoproj/argo
workflow/controller/controller.go
processNextItem
func (wfc *WorkflowController) processNextItem() bool { key, quit := wfc.wfQueue.Get() if quit { return false } defer wfc.wfQueue.Done(key) obj, exists, err := wfc.wfInformer.GetIndexer().GetByKey(key.(string)) if err != nil { log.Errorf("Failed to get workflow '%s' from informer index: %+v", key, err) ret...
go
func (wfc *WorkflowController) processNextItem() bool { key, quit := wfc.wfQueue.Get() if quit { return false } defer wfc.wfQueue.Done(key) obj, exists, err := wfc.wfInformer.GetIndexer().GetByKey(key.(string)) if err != nil { log.Errorf("Failed to get workflow '%s' from informer index: %+v", key, err) ret...
[ "func", "(", "wfc", "*", "WorkflowController", ")", "processNextItem", "(", ")", "bool", "{", "key", ",", "quit", ":=", "wfc", ".", "wfQueue", ".", "Get", "(", ")", "\n", "if", "quit", "{", "return", "false", "\n", "}", "\n", "defer", "wfc", ".", "...
// processNextItem is the worker logic for handling workflow updates
[ "processNextItem", "is", "the", "worker", "logic", "for", "handling", "workflow", "updates" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/controller.go#L198-L266
134,586
argoproj/argo
workflow/controller/controller.go
processNextPodItem
func (wfc *WorkflowController) processNextPodItem() bool { key, quit := wfc.podQueue.Get() if quit { return false } defer wfc.podQueue.Done(key) obj, exists, err := wfc.podInformer.GetIndexer().GetByKey(key.(string)) if err != nil { log.Errorf("Failed to get pod '%s' from informer index: %+v", key, err) re...
go
func (wfc *WorkflowController) processNextPodItem() bool { key, quit := wfc.podQueue.Get() if quit { return false } defer wfc.podQueue.Done(key) obj, exists, err := wfc.podInformer.GetIndexer().GetByKey(key.(string)) if err != nil { log.Errorf("Failed to get pod '%s' from informer index: %+v", key, err) re...
[ "func", "(", "wfc", "*", "WorkflowController", ")", "processNextPodItem", "(", ")", "bool", "{", "key", ",", "quit", ":=", "wfc", ".", "podQueue", ".", "Get", "(", ")", "\n", "if", "quit", "{", "return", "false", "\n", "}", "\n", "defer", "wfc", ".",...
// processNextPodItem is the worker logic for handling pod updates. // For pods updates, this simply means to "wake up" the workflow by // adding the corresponding workflow key into the workflow workqueue.
[ "processNextPodItem", "is", "the", "worker", "logic", "for", "handling", "pod", "updates", ".", "For", "pods", "updates", "this", "simply", "means", "to", "wake", "up", "the", "workflow", "by", "adding", "the", "corresponding", "workflow", "key", "into", "the"...
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/controller.go#L276-L314
134,587
argoproj/argo
workflow/executor/executor.go
NewExecutor
func NewExecutor(clientset kubernetes.Interface, podName, namespace, podAnnotationsPath string, cre ContainerRuntimeExecutor, template wfv1.Template) WorkflowExecutor { return WorkflowExecutor{ PodName: podName, ClientSet: clientset, Namespace: namespace, PodAnnotationsPath: podAnn...
go
func NewExecutor(clientset kubernetes.Interface, podName, namespace, podAnnotationsPath string, cre ContainerRuntimeExecutor, template wfv1.Template) WorkflowExecutor { return WorkflowExecutor{ PodName: podName, ClientSet: clientset, Namespace: namespace, PodAnnotationsPath: podAnn...
[ "func", "NewExecutor", "(", "clientset", "kubernetes", ".", "Interface", ",", "podName", ",", "namespace", ",", "podAnnotationsPath", "string", ",", "cre", "ContainerRuntimeExecutor", ",", "template", "wfv1", ".", "Template", ")", "WorkflowExecutor", "{", "return", ...
// NewExecutor instantiates a new workflow executor
[ "NewExecutor", "instantiates", "a", "new", "workflow", "executor" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L97-L109
134,588
argoproj/argo
workflow/executor/executor.go
HandleError
func (we *WorkflowExecutor) HandleError() { if r := recover(); r != nil { _ = we.AddAnnotation(common.AnnotationKeyNodeMessage, fmt.Sprintf("%v", r)) log.Fatalf("executor panic: %+v\n%s", r, debug.Stack()) } else { if len(we.errors) > 0 { _ = we.AddAnnotation(common.AnnotationKeyNodeMessage, we.errors[0].Err...
go
func (we *WorkflowExecutor) HandleError() { if r := recover(); r != nil { _ = we.AddAnnotation(common.AnnotationKeyNodeMessage, fmt.Sprintf("%v", r)) log.Fatalf("executor panic: %+v\n%s", r, debug.Stack()) } else { if len(we.errors) > 0 { _ = we.AddAnnotation(common.AnnotationKeyNodeMessage, we.errors[0].Err...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "HandleError", "(", ")", "{", "if", "r", ":=", "recover", "(", ")", ";", "r", "!=", "nil", "{", "_", "=", "we", ".", "AddAnnotation", "(", "common", ".", "AnnotationKeyNodeMessage", ",", "fmt", ".", "S...
// HandleError is a helper to annotate the pod with the error message upon a unexpected executor panic or error
[ "HandleError", "is", "a", "helper", "to", "annotate", "the", "pod", "with", "the", "error", "message", "upon", "a", "unexpected", "executor", "panic", "or", "error" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L112-L121
134,589
argoproj/argo
workflow/executor/executor.go
LoadArtifacts
func (we *WorkflowExecutor) LoadArtifacts() error { log.Infof("Start loading input artifacts...") for _, art := range we.Template.Inputs.Artifacts { log.Infof("Downloading artifact: %s", art.Name) if !art.HasLocation() { if art.Optional { log.Warnf("Ignoring optional artifact '%s' which was not supplied...
go
func (we *WorkflowExecutor) LoadArtifacts() error { log.Infof("Start loading input artifacts...") for _, art := range we.Template.Inputs.Artifacts { log.Infof("Downloading artifact: %s", art.Name) if !art.HasLocation() { if art.Optional { log.Warnf("Ignoring optional artifact '%s' which was not supplied...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "LoadArtifacts", "(", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "for", "_", ",", "art", ":=", "range", "we", ".", "Template", ".", "Inputs", ".", "Artifacts", "{", "log", ...
// LoadArtifacts loads artifacts from location to a container path
[ "LoadArtifacts", "loads", "artifacts", "from", "location", "to", "a", "container", "path" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L124-L188
134,590
argoproj/argo
workflow/executor/executor.go
SaveArtifacts
func (we *WorkflowExecutor) SaveArtifacts() error { if len(we.Template.Outputs.Artifacts) == 0 { log.Infof("No output artifacts") return nil } log.Infof("Saving output artifacts") mainCtrID, err := we.GetMainContainerID() if err != nil { return err } err = os.MkdirAll(tempOutArtDir, os.ModePerm) if err !...
go
func (we *WorkflowExecutor) SaveArtifacts() error { if len(we.Template.Outputs.Artifacts) == 0 { log.Infof("No output artifacts") return nil } log.Infof("Saving output artifacts") mainCtrID, err := we.GetMainContainerID() if err != nil { return err } err = os.MkdirAll(tempOutArtDir, os.ModePerm) if err !...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "SaveArtifacts", "(", ")", "error", "{", "if", "len", "(", "we", ".", "Template", ".", "Outputs", ".", "Artifacts", ")", "==", "0", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "ni...
// SaveArtifacts uploads artifacts to the archive location
[ "SaveArtifacts", "uploads", "artifacts", "to", "the", "archive", "location" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L214-L238
134,591
argoproj/argo
workflow/executor/executor.go
SaveParameters
func (we *WorkflowExecutor) SaveParameters() error { if len(we.Template.Outputs.Parameters) == 0 { log.Infof("No output parameters") return nil } log.Infof("Saving output parameters") mainCtrID, err := we.GetMainContainerID() if err != nil { return err } for i, param := range we.Template.Outputs.Parameter...
go
func (we *WorkflowExecutor) SaveParameters() error { if len(we.Template.Outputs.Parameters) == 0 { log.Infof("No output parameters") return nil } log.Infof("Saving output parameters") mainCtrID, err := we.GetMainContainerID() if err != nil { return err } for i, param := range we.Template.Outputs.Parameter...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "SaveParameters", "(", ")", "error", "{", "if", "len", "(", "we", ".", "Template", ".", "Outputs", ".", "Parameters", ")", "==", "0", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "...
// SaveParameters will save the content in the specified file path as output parameter value
[ "SaveParameters", "will", "save", "the", "content", "in", "the", "specified", "file", "path", "as", "output", "parameter", "value" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L391-L435
134,592
argoproj/argo
workflow/executor/executor.go
SaveLogs
func (we *WorkflowExecutor) SaveLogs() (*wfv1.Artifact, error) { if we.Template.ArchiveLocation == nil || we.Template.ArchiveLocation.ArchiveLogs == nil || !*we.Template.ArchiveLocation.ArchiveLogs { return nil, nil } log.Infof("Saving logs") mainCtrID, err := we.GetMainContainerID() if err != nil { return nil...
go
func (we *WorkflowExecutor) SaveLogs() (*wfv1.Artifact, error) { if we.Template.ArchiveLocation == nil || we.Template.ArchiveLocation.ArchiveLogs == nil || !*we.Template.ArchiveLocation.ArchiveLogs { return nil, nil } log.Infof("Saving logs") mainCtrID, err := we.GetMainContainerID() if err != nil { return nil...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "SaveLogs", "(", ")", "(", "*", "wfv1", ".", "Artifact", ",", "error", ")", "{", "if", "we", ".", "Template", ".", "ArchiveLocation", "==", "nil", "||", "we", ".", "Template", ".", "ArchiveLocation", "."...
// SaveLogs saves logs
[ "SaveLogs", "saves", "logs" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L438-L492
134,593
argoproj/argo
workflow/executor/executor.go
GetSecretFromVolMount
func (we *WorkflowExecutor) GetSecretFromVolMount(accessKeyName string, accessKey string) ([]byte, error) { return ioutil.ReadFile(filepath.Join(common.SecretVolMountPath, accessKeyName, accessKey)) }
go
func (we *WorkflowExecutor) GetSecretFromVolMount(accessKeyName string, accessKey string) ([]byte, error) { return ioutil.ReadFile(filepath.Join(common.SecretVolMountPath, accessKeyName, accessKey)) }
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "GetSecretFromVolMount", "(", "accessKeyName", "string", ",", "accessKey", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "ioutil", ".", "ReadFile", "(", "filepath", ".", "Join", "("...
// GetSecretFromVolMount will retrive the Secrets from VolumeMount
[ "GetSecretFromVolMount", "will", "retrive", "the", "Secrets", "from", "VolumeMount" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L495-L497
134,594
argoproj/argo
workflow/executor/executor.go
saveLogToFile
func (we *WorkflowExecutor) saveLogToFile(mainCtrID, path string) error { outFile, err := os.Create(path) if err != nil { return errors.InternalWrapError(err) } defer func() { _ = outFile.Close() }() reader, err := we.RuntimeExecutor.GetOutputStream(mainCtrID, true) if err != nil { return err } defer func()...
go
func (we *WorkflowExecutor) saveLogToFile(mainCtrID, path string) error { outFile, err := os.Create(path) if err != nil { return errors.InternalWrapError(err) } defer func() { _ = outFile.Close() }() reader, err := we.RuntimeExecutor.GetOutputStream(mainCtrID, true) if err != nil { return err } defer func()...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "saveLogToFile", "(", "mainCtrID", ",", "path", "string", ")", "error", "{", "outFile", ",", "err", ":=", "os", ".", "Create", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ...
// saveLogToFile saves the entire log output of a container to a local file
[ "saveLogToFile", "saves", "the", "entire", "log", "output", "of", "a", "container", "to", "a", "local", "file" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L500-L516
134,595
argoproj/argo
workflow/executor/executor.go
getPod
func (we *WorkflowExecutor) getPod() (*apiv1.Pod, error) { podsIf := we.ClientSet.CoreV1().Pods(we.Namespace) var pod *apiv1.Pod var err error _ = wait.ExponentialBackoff(retry.DefaultRetry, func() (bool, error) { pod, err = podsIf.Get(we.PodName, metav1.GetOptions{}) if err != nil { log.Warnf("Failed to get...
go
func (we *WorkflowExecutor) getPod() (*apiv1.Pod, error) { podsIf := we.ClientSet.CoreV1().Pods(we.Namespace) var pod *apiv1.Pod var err error _ = wait.ExponentialBackoff(retry.DefaultRetry, func() (bool, error) { pod, err = podsIf.Get(we.PodName, metav1.GetOptions{}) if err != nil { log.Warnf("Failed to get...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "getPod", "(", ")", "(", "*", "apiv1", ".", "Pod", ",", "error", ")", "{", "podsIf", ":=", "we", ".", "ClientSet", ".", "CoreV1", "(", ")", ".", "Pods", "(", "we", ".", "Namespace", ")", "\n", "var...
// getPod is a wrapper around the pod interface to get the current pod from kube API server
[ "getPod", "is", "a", "wrapper", "around", "the", "pod", "interface", "to", "get", "the", "current", "pod", "from", "kube", "API", "server" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L604-L623
134,596
argoproj/argo
workflow/executor/executor.go
GetConfigMapKey
func (we *WorkflowExecutor) GetConfigMapKey(namespace, name, key string) (string, error) { cachedKey := fmt.Sprintf("%s/%s/%s", namespace, name, key) if val, ok := we.memoizedConfigMaps[cachedKey]; ok { return val, nil } configmapsIf := we.ClientSet.CoreV1().ConfigMaps(namespace) var configmap *apiv1.ConfigMap ...
go
func (we *WorkflowExecutor) GetConfigMapKey(namespace, name, key string) (string, error) { cachedKey := fmt.Sprintf("%s/%s/%s", namespace, name, key) if val, ok := we.memoizedConfigMaps[cachedKey]; ok { return val, nil } configmapsIf := we.ClientSet.CoreV1().ConfigMaps(namespace) var configmap *apiv1.ConfigMap ...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "GetConfigMapKey", "(", "namespace", ",", "name", ",", "key", "string", ")", "(", "string", ",", "error", ")", "{", "cachedKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "namespace", ",", "name...
// GetConfigMapKey retrieves a configmap value and memoizes the result
[ "GetConfigMapKey", "retrieves", "a", "configmap", "value", "and", "memoizes", "the", "result" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L631-L663
134,597
argoproj/argo
workflow/executor/executor.go
GetSecrets
func (we *WorkflowExecutor) GetSecrets(namespace, name, key string) ([]byte, error) { cachedKey := fmt.Sprintf("%s/%s/%s", namespace, name, key) if val, ok := we.memoizedSecrets[cachedKey]; ok { return val, nil } secretsIf := we.ClientSet.CoreV1().Secrets(namespace) var secret *apiv1.Secret var err error _ = w...
go
func (we *WorkflowExecutor) GetSecrets(namespace, name, key string) ([]byte, error) { cachedKey := fmt.Sprintf("%s/%s/%s", namespace, name, key) if val, ok := we.memoizedSecrets[cachedKey]; ok { return val, nil } secretsIf := we.ClientSet.CoreV1().Secrets(namespace) var secret *apiv1.Secret var err error _ = w...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "GetSecrets", "(", "namespace", ",", "name", ",", "key", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cachedKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "namespace", ",", ...
// GetSecrets retrieves a secret value and memoizes the result
[ "GetSecrets", "retrieves", "a", "secret", "value", "and", "memoizes", "the", "result" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L666-L698
134,598
argoproj/argo
workflow/executor/executor.go
GetMainContainerStatus
func (we *WorkflowExecutor) GetMainContainerStatus() (*apiv1.ContainerStatus, error) { pod, err := we.getPod() if err != nil { return nil, err } for _, ctrStatus := range pod.Status.ContainerStatuses { if ctrStatus.Name == common.MainContainerName { return &ctrStatus, nil } } return nil, nil }
go
func (we *WorkflowExecutor) GetMainContainerStatus() (*apiv1.ContainerStatus, error) { pod, err := we.getPod() if err != nil { return nil, err } for _, ctrStatus := range pod.Status.ContainerStatuses { if ctrStatus.Name == common.MainContainerName { return &ctrStatus, nil } } return nil, nil }
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "GetMainContainerStatus", "(", ")", "(", "*", "apiv1", ".", "ContainerStatus", ",", "error", ")", "{", "pod", ",", "err", ":=", "we", ".", "getPod", "(", ")", "\n", "if", "err", "!=", "nil", "{", "retu...
// GetMainContainerStatus returns the container status of the main container, nil if the main container does not exist
[ "GetMainContainerStatus", "returns", "the", "container", "status", "of", "the", "main", "container", "nil", "if", "the", "main", "container", "does", "not", "exist" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L701-L712
134,599
argoproj/argo
workflow/executor/executor.go
GetMainContainerID
func (we *WorkflowExecutor) GetMainContainerID() (string, error) { if we.mainContainerID != "" { return we.mainContainerID, nil } ctrStatus, err := we.GetMainContainerStatus() if err != nil { return "", err } if ctrStatus == nil { return "", nil } we.mainContainerID = containerID(ctrStatus.ContainerID) r...
go
func (we *WorkflowExecutor) GetMainContainerID() (string, error) { if we.mainContainerID != "" { return we.mainContainerID, nil } ctrStatus, err := we.GetMainContainerStatus() if err != nil { return "", err } if ctrStatus == nil { return "", nil } we.mainContainerID = containerID(ctrStatus.ContainerID) r...
[ "func", "(", "we", "*", "WorkflowExecutor", ")", "GetMainContainerID", "(", ")", "(", "string", ",", "error", ")", "{", "if", "we", ".", "mainContainerID", "!=", "\"", "\"", "{", "return", "we", ".", "mainContainerID", ",", "nil", "\n", "}", "\n", "ctr...
// GetMainContainerID returns the container id of the main container
[ "GetMainContainerID", "returns", "the", "container", "id", "of", "the", "main", "container" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L715-L728