Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/chromedp/chromedp
/ functions
Functions
1,064 in github.com/chromedp/chromedp
⨍
Functions
1,064
◇
Types & classes
83
↓ 203 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:79
↓ 142 callers
Function
testAllocate
(tb testing.TB, name string)
chromedp_test.go:159
↓ 104 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:196
↓ 91 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:60
↓ 80 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:269
↓ 78 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
↓ 48 callers
Function
FromContext
FromContext returns the Context that a context.Context holds, or nil.
chromedp.go:333
↓ 44 callers
Function
NewExecAllocator
NewExecAllocator creates a new context with an ExecAllocator. Use it with NewContext.
allocate.go:134
↓ 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
↓ 37 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:99
↓ 28 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
↓ 27 callers
Method
Close
Close sends a close frame with the code 1000 if it can do that in a short time. Then it waits for at most one second for the close frame of the server
remote/internal/websocket/conn.go:408
↓ 25 callers
Method
Dial
Dial connects to a ws or wss address and runs the opening handshake of RFC 6455 section 4.1. It uses net/http for the request, so it handles the defau
remote/internal/websocket/handshake.go:74
↓ 25 callers
Method
ReadMessage
ReadMessage reads the next text or binary message. It joins the fragments of a message, answers a ping with a pong, and skips a pong. The returned byt
remote/internal/websocket/conn.go:144
↓ 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:1200
↓ 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
Nodes
Nodes is an element query action that retrieves the document element nodes matching the selector.
query.go:839
↓ 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
↓ 20 callers
Function
o
()
testdata/twgl-full.min.js:6
↓ 19 callers
Method
push
(v jsonv2.Value)
session.go:144
↓ 18 callers
Method
Error
Error returns the code and the reason.
remote/internal/websocket/close.go:59
↓ 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:1000
↓ 17 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
↓ 17 callers
Function
WaitVisible
WaitVisible is an element query action that waits until the element matching the selector is visible.
query.go:809
↓ 17 callers
Method
Write
(context.Context, *cdproto.Message)
browser.go:44
↓ 16 callers
Function
Text
Text is an element query action that retrieves the visible text of the first element node matching the selector.
query.go:912
↓ 16 callers
Function
Title
Title is an action that retrieves the document title.
nav.go:124
↓ 16 callers
Function
URL
URL returns the ws address of an HTTP test server.
remote/internal/wstest/wstest.go:135
↓ 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
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:351
↓ 15 callers
Function
newTestConn
newTestConn makes a Conn that reads the given bytes.
remote/internal/websocket/conn_test.go:48
↓ 15 callers
Function
writeHTML
(content string)
example_test.go:26
↓ 14 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
↓ 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
Events
Events subscribes to the event on the target of the context, and returns an iterator over its payloads. It replaces ListenTarget. Use [Listen] when th
action.go:143
↓ 13 callers
Function
b
(e)
testdata/twgl-full.min.js:6
↓ 13 callers
Method
written
()
remote/internal/websocket/conn_test.go:41
↓ 12 callers
Method
Read
(context.Context, *cdproto.Message)
browser.go:43
↓ 12 callers
Function
frame
frame builds an unmasked server frame by hand.
remote/internal/websocket/conn_test.go:104
↓ 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
Close
Close satisfies the io.Closer interface.
remote/conn.go:88
↓ 11 callers
Method
ReadFrame
ReadFrame reads one frame from the client and unmasks it. It gives up after five seconds. It fails when the client does not mask the frame, as RFC 645
remote/internal/wstest/wstest.go:178
↓ 11 callers
Function
parseClientFrames
parseClientFrames parses the bytes that the client wrote. It does so with its own code, and it fails when a frame is not masked.
remote/internal/websocket/conn_test.go:67
↓ 10 callers
Function
DialContext
DialContext dials the websocket URL.
remote/conn.go:56
↓ 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
Method
WriteText
WriteText sends p as one text frame. RFC 6455 section 5.6 asks the caller for valid UTF-8. Chrome does not support incoming fragments, so the method n
remote/internal/websocket/conn.go:314
↓ 10 callers
Function
cat
(parts ...[]byte)
remote/internal/websocket/conn_test.go:122
↓ 10 callers
Function
f
(e,r,t,n,o,u,i)
testdata/twgl-full.min.js:6
↓ 9 callers
Method
Do
Do runs the action. The context holds the chromedp context.
action.go:109
↓ 9 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
↓ 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
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
↓ 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
QueryNodeIDs
QueryNodeIDs is an element query action that retrieves the element node IDs matching the selector.
query.go:847
↓ 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
Method
get
()
remote/internal/websocket/handshake.go:263
↓ 8 callers
Function
mustHex
mustHex decodes a hex string. A space is allowed.
remote/internal/websocket/frame_test.go:14
↓ 8 callers
Method
set
(c net.Conn)
remote/internal/websocket/handshake.go:257
↓ 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
Method
snapshot
snapshot returns the events that the recorder holds now.
listen_test.go:32
↓ 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
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
Function
NewServer
NewServer starts a test server that upgrades each request and calls handle with the request and the connection. It closes the connection when handle r
remote/internal/wstest/wstest.go:113
↓ 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:594
↓ 7 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:742
↓ 7 callers
Method
WriteFrame
WriteFrame sends an unmasked frame with the FIN bit set.
remote/internal/wstest/wstest.go:160
↓ 7 callers
Function
a
(e)
testdata/twgl-full.min.js:6
↓ 7 callers
Method
listen
listen adds a func that the target calls for each event. Canceling ctx stops the calls. The target calls the func synchronously, so the func must not
chromedp.go:1082
↓ 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
CombinedOutput
CombinedOutput sets the io.Writer that receives the stdout and stderr of the browser.
allocate.go:898
↓ 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
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:159
↓ 6 callers
Function
initContextBrowser
(ctx context.Context)
chromedp.go:396
↓ 6 callers
Function
initContextTarget
initContextTarget is like initContextBrowser, and also attaches the target of the context when it has none yet.
chromedp.go:444
↓ 6 callers
Function
newWebsocketServer
newWebsocketServer starts a server that upgrades each request to a websocket and passes the connection to handle. It returns the ws address.
remote/conn_test.go:22
↓ 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
upgradeServer
upgradeServer starts a server that upgrades with the extra response headers, and sends each request to the channel.
remote/internal/websocket/handshake_test.go:25
↓ 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:738
↓ 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:1090
↓ 5 callers
Method
Close
()
remote/internal/websocket/conn_test.go:34
↓ 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
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
↓ 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
next →
1–100 of 1,064, ranked by callers