Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/chromedp/chromedp
/ functions
Functions
912 in github.com/chromedp/chromedp
⨍
Functions
912
◇
Types & classes
69
↓ 193 callers
Function
Do
Do runs the actions against the target of the context, in order. It stops at the first error. See [Run] for the rules about the context. For example:
action.go:78
↓ 132 callers
Function
testAllocate
(tb testing.TB, name string)
chromedp_test.go:159
↓ 97 callers
Function
NewContext
NewContext creates a chromedp context from the parent context. The context inherits the Allocator of the parent. By default, that is an ExecAllocator
chromedp.go:187
↓ 84 callers
Function
Run
Run runs the action against the target of the context, and returns its value. The context must be a chromedp context, typically made with [NewContext]
action.go:59
↓ 77 callers
Method
Call
Call sends the command to the target, waits for the response, and decodes the result into res. It satisfies [cdp.Session]. Call returns a browser err
target.go:181
↓ 74 callers
Function
Navigate
Navigate is an action that navigates the current frame and waits for the page to load. This action does not collect HTTP response information. To get
nav.go:17
↓ 60 callers
Function
into
into makes an action that runs a and stores its value in dst. The tests use it to run several actions in one call of Do and still read their values.
chromedp_test.go:146
↓ 44 callers
Function
NewExecAllocator
NewExecAllocator creates a new context with an ExecAllocator. Use it with NewContext.
allocate.go:134
↓ 41 callers
Function
FromContext
FromContext returns the Context that a context.Context holds, or nil.
chromedp.go:324
↓ 40 callers
Method
Close
Close satisfies the io.Closer interface. It closes both ends of the pipe, which makes the browser exit.
pipe.go:62
↓ 38 callers
Method
Error
Error satisfies the error interface.
errors.go:58
↓ 32 callers
Function
Func
Func makes an action that returns no value from a func that returns only an error.
action.go:98
↓ 27 callers
Function
ptr
ptr returns a pointer to a copy of v. It sets the optional fields of the protocol types, which are pointers.
util.go:335
↓ 24 callers
Function
Click
Click is an element query action that sends a mouse click event to the first element node matching the selector.
query.go:1199
↓ 24 callers
Function
Flag
Flag is a generic command line option that passes a flag to Chrome. If the value is a string, Flag passes --name=value. If it is a boolean, Flag passe
allocate.go:704
↓ 24 callers
Function
first
first returns the first node of the query result, or an error when the query matched no node.
query.go:221
↓ 22 callers
Function
Nodes
Nodes is an element query action that retrieves the document element nodes matching the selector.
query.go:838
↓ 20 callers
Function
o
()
testdata/twgl-full.min.js:6
↓ 19 callers
Method
push
(v jsonv2.Value)
session.go:144
↓ 18 callers
Function
Value
Value is an element query action that retrieves the JavaScript value field of the first element node matching the selector. Use it to read the JavaSc
query.go:999
↓ 16 callers
Function
WaitVisible
WaitVisible is an element query action that waits until the element matching the selector is visible.
query.go:808
↓ 16 callers
Function
queryDo
queryDo is like QueryAfter for a func that returns no value. A nil f only waits for the nodes.
query.go:210
↓ 15 callers
Function
Text
Text is an element query action that retrieves the visible text of the first element node matching the selector.
query.go:911
↓ 15 callers
Function
Title
Title is an action that retrieves the document title.
nav.go:124
↓ 15 callers
Method
Wait
Wait blocks until the allocator has freed all of its resources. Canceling the allocator context does this too, so normally you do not need to call Wai
allocate.go:32
↓ 15 callers
Function
writeHTML
(content string)
example_test.go:26
↓ 14 callers
Function
Cancel
Cancel cancels a chromedp context, waits until the context frees its resources, and returns any error that occurred. If the context allocated a brows
chromedp.go:342
↓ 14 callers
Function
QueryAfter
QueryAfter is an element query action that queries the browser for selector sel. It waits until the node conditions of the query are met, then runs f
query.go:195
↓ 13 callers
Function
Call
Call runs the protocol command with the params on the target of the chromedp context, and returns its result. As [Run] does, it starts the browser and
call.go:22
↓ 13 callers
Function
Events
Events subscribes to the event on the target of the context, and returns an iterator over its payloads. It replaces ListenTarget. The subscription st
action.go:141
↓ 13 callers
Function
b
(e)
testdata/twgl-full.min.js:6
↓ 12 callers
Function
n
(e)
testdata/twgl-full.min.js:6
↓ 12 callers
Function
withOpts
withOpts returns the options followed by the extra options, without changing the array of opts.
query.go:230
↓ 11 callers
Method
Write
(context.Context, *cdproto.Message)
browser.go:44
↓ 10 callers
Function
NewAllocator
NewAllocator creates a new context with an [Allocator]. Use it with chromedp.NewContext. The url must point to the websocket address of the browser, s
remote/allocator.go:32
↓ 10 callers
Function
f
(e,r,t,n,o,u,i)
testdata/twgl-full.min.js:6
↓ 9 callers
Method
Close
Close satisfies the io.Closer interface.
remote/conn.go:106
↓ 9 callers
Function
Query
Query is an action that queries the browser for element nodes that match the criteria, and waits until they meet the node conditions. It returns no va
query.go:188
↓ 9 callers
Function
testAllocateSeparate
(tb testing.TB)
chromedp_test.go:187
↓ 8 callers
Function
ExecPath
ExecPath returns an ExecAllocatorOption that uses the given path to run browser processes. The path can be an absolute path to a binary, or the name o
allocate.go:618
↓ 8 callers
Function
ExposeFunc
ExposeFunc is an action that makes the Go func fn available to the page as window.<name>. A page script calls it like an async function. The call retu
expose.go:67
↓ 8 callers
Function
QueryNodeIDs
QueryNodeIDs is an element query action that retrieves the element node IDs matching the selector.
query.go:846
↓ 8 callers
Method
String
String returns the name of the node type.
node.go:327
↓ 8 callers
Method
String
String returns the text that was written.
remote/websocket_test.go:162
↓ 8 callers
Function
setupExecAllocator
setupExecAllocator is like NewExecAllocator, but NewContext uses it to create the allocator without an extra context layer.
allocate.go:53
↓ 8 callers
Function
t
(n)
testdata/twgl-full.min.js:6
↓ 8 callers
Function
v
(e,r)
testdata/twgl-full.min.js:6
↓ 8 callers
Function
y
(e)
testdata/twgl-full.min.js:6
↓ 7 callers
Function
Allocate
Allocate returns the context of a new tab in the browser that all tests share, and a func that closes the tab. The first call starts the browser. If n
internal/chromedptest/chromedptest.go:216
↓ 7 callers
Function
DialContext
DialContext dials the websocket URL with gobwas/ws.
remote/conn.go:59
↓ 7 callers
Function
Into
Into makes an action that runs a and stores its value in dst. The tests use it to run several actions in one call of chromedp.Do and still read their
internal/chromedptest/chromedptest.go:202
↓ 7 callers
Function
KeptOpen
KeptOpen returns the websocket address of the browser of the context and the user data directory of the browser, so that a program can print them. Ano
keepopen.go:73
↓ 7 callers
Method
Read
(context.Context, *cdproto.Message)
browser.go:43
↓ 7 callers
Function
UserDataDir
UserDataDir is the command line option to set the user data directory. Use it to choose the profile directory of Chrome. Without it, ExecAllocator cre
allocate.go:780
↓ 7 callers
Function
WaitFunc
WaitFunc is an element query option to set a custom node condition wait.
query.go:593
↓ 7 callers
Function
a
(e)
testdata/twgl-full.min.js:6
↓ 7 callers
Function
read
(t *testing.T, path string)
docs/docs_test.go:275
↓ 7 callers
Function
selectedIDs
selectedIDs runs Nodes with the selector and returns the id attribute of each node that it selects.
query_test.go:1607
↓ 6 callers
Function
CallBrowser
CallBrowser runs the protocol command with the params on the browser of the chromedp context, and returns its result. Use it for the commands of the b
call.go:38
↓ 6 callers
Function
CombinedOutput
CombinedOutput sets the io.Writer that receives the stdout and stderr of the browser.
allocate.go:898
↓ 6 callers
Method
Do
Do runs the action. The context holds the chromedp context.
action.go:108
↓ 6 callers
Function
EmulateViewport
EmulateViewport is an action that changes the browser viewport. It wraps calls to emulation.SetDeviceMetricsOverride and emulation.SetTouchEmulationE
emulate.go:20
↓ 6 callers
Function
J
(e,r,t,n)
testdata/twgl-full.min.js:6
↓ 6 callers
Function
ModifyCmdFunc
ModifyCmdFunc runs a func on the exec.Cmd of the browser. It replaces the default func, which sends SIGKILL to any open browsers when the Go program e
allocate.go:771
↓ 6 callers
Function
NewPipeConn
NewPipeConn returns a Transport that reads the messages of the browser from r and writes the messages for the browser to w. Close closes both r and w.
pipe.go:48
↓ 6 callers
Function
WithTargetID
WithTargetID makes a context attach to an existing target, and not create a new one. It also works for an iframe from another site (a cross-site ifra
chromedp.go:723
↓ 6 callers
Function
s
(e,r)
testdata/twgl-full.min.js:6
↓ 6 callers
Function
ue
(e,r,t)
testdata/twgl-full.min.js:6
↓ 6 callers
Function
websocketOpts
websocketOpts returns the options of the exec allocator in the websocket mode, followed by extra.
remote/websocket_test.go:26
↓ 5 callers
Function
AtLeast
AtLeast is an element query option that sets the minimum number of elements that the query must return. By default, a query needs 1.
query.go:737
↓ 5 callers
Function
AttributeValue
AttributeValue is an element query action that retrieves the element attribute value for the first element node matching the selector. The result tell
query.go:1089
↓ 5 callers
Function
Console
Console subscribes to the console of the target of the context, and returns an iterator over its messages. A message is a call of the console API such
console.go:130
↓ 5 callers
Function
DragAndDrop
DragAndDrop is an element query action that drags the first element node that matches from, and drops it on the first element node that matches to. It
drag.go:47
↓ 5 callers
Function
PrintToPDF
PrintToPDF is an action that prints the page to a PDF file, and returns the bytes of the file. With no option, the browser prints on Letter paper, in
pdf.go:61
↓ 5 callers
Function
RunResponse
RunResponse is an alternative to [Do] for a list of actions that trigger a page navigation, such as a click on a link or a button. RunResponse runs t
chromedp.go:796
↓ 5 callers
Function
WaitReady
WaitReady is an element query action that waits until the element that matches the selector is ready (that is, "loaded").
query.go:802
↓ 5 callers
Function
WithDialer
WithDialer is an ExecAllocatorOption that makes the allocator connect to the browser with a websocket, as chromedp did before the pipe became the defa
allocate.go:915
↓ 5 callers
Function
WithLogf
WithLogf is a shortcut for WithBrowserOption(WithBrowserLogf(f)).
chromedp.go:760
↓ 5 callers
Function
WithPollingTimeout
WithPollingTimeout sets the maximum time to wait until the predicate returns a truthy value. It defaults to 30 seconds. Pass 0 to disable the timeout.
poll.go:157
↓ 5 callers
Function
WithVisibleWindow
WithVisibleWindow makes NewContext build the default allocator with [VisibleWindow] and without Headless, so that the browser opens a visible window.
chromedp.go:638
↓ 5 callers
Function
grab
grab retrieves a file from the chromium source code. It tries each source in order and returns the first file that it can download and that is not emp
kb/gen.go:461
↓ 5 callers
Function
initContextBrowser
(ctx context.Context)
chromedp.go:387
↓ 5 callers
Function
initContextTarget
initContextTarget is like initContextBrowser, and also attaches the target of the context when it has none yet.
chromedp.go:435
↓ 5 callers
Function
matchPixel
(buf []byte, want string)
test/screenshot_test.go:226
↓ 5 callers
Function
waitLoad
waitLoad makes an action that runs the steps and waits until the page loads. It does not return the response.
chromedp.go:942
↓ 5 callers
Method
waitReady
waitReady waits for the specified nodes to be ready.
query.go:331
↓ 5 callers
Function
walk
(m map[cdp.NodeID]*Node, n *Node)
util.go:60
↓ 4 callers
Function
$
()
testdata/twgl-full.min.js:6
↓ 4 callers
Method
Close
()
pipe_test.go:24
↓ 4 callers
Function
Location
Location is an action that retrieves the document location.
nav.go:119
↓ 4 callers
Function
MouseClickNode
MouseClickNode is an action that dispatches a left mouse button click event at the center of a node. Note: the action scrolls the window if the node
input.go:79
↓ 4 callers
Function
N
(e,r,t)
testdata/twgl-full.min.js:6
↓ 4 callers
Function
NewBrowserTransport
NewBrowserTransport creates a new browser that uses tr, a connection to a browser that is already open, such as a [*PipeConn]. The browser closes tr w
browser.go:139
↓ 4 callers
Function
PDFLandscape
PDFLandscape is an option of [PrintToPDF] that prints in landscape. The width and the height of the paper swap.
pdf.go:104
↓ 4 callers
Function
PDFMargin
PDFMargin is an option of [PrintToPDF] that sets the four margins to the same length in inches. The default is 1 cm, which is about 0.4 inches. A marg
pdf.go:122
↓ 4 callers
Function
PDFPaper
PDFPaper is an option of [PrintToPDF] that sets the size of the paper. Give one of the sizes of the package, such as [PaperA4], or a [PaperSize] of yo
pdf.go:113
↓ 4 callers
Method
Process
Process returns the process object of the browser. It is nil when the browser was allocated by an allocator that attaches to a browser that runs alre
browser.go:189
↓ 4 callers
Function
Screenshot
Screenshot is an element query action that takes a screenshot of the first element node that matches the selector. It acts like the command "Capture
screenshot.go:30
↓ 4 callers
Function
SendKeys
SendKeys is an element query action that sends key events to the first element node that matches the selector. It synthesizes the key down, char, and
query.go:1285
↓ 4 callers
Function
WithDebugf
WithDebugf is a shortcut for WithBrowserOption(WithBrowserDebugf(f)).
chromedp.go:770
next →
1–100 of 912, ranked by callers