16 KiB
Page
_Auto generated documentation for WebKit inspector
Actions and events related to the inspected page belong to the page domain.
- Commands
- enable
- disable
- addScriptToEvaluateOnLoad
- removeScriptToEvaluateOnLoad
- reload
- navigate
- getCookies
- deleteCookie
- getResourceTree
- getResourceContent
- searchInResource
- searchInResources
- setDocumentContent
- setShowPaintRects
- getScriptExecutionStatus
- setScriptExecutionDisabled
- setTouchEmulationEnabled
- setEmulatedMedia
- getCompositingBordersVisible
- setCompositingBordersVisible
- snapshotNode
- snapshotRect
- handleJavaScriptDialog
- archive
- Events
- domContentEventFired
- loadEventFired
- frameNavigated
- frameDetached
- frameStartedLoading
- frameStoppedLoading
- frameScheduledNavigation
- frameClearedScheduledNavigation
- javascriptDialogOpening
- javascriptDialogClosed
- scriptsEnabled
- Types
- ResourceType
- CoordinateSystem
- Frame
- FrameResource
- FrameResourceTree
- SearchResult
- Cookie
- ScriptIdentifier
Commands
Page.enable(callback)
Enables page domain notifications.
Parameters
callback ( function )
Results
error ( error )
Page.disable(callback)
Disables page domain notifications.
Parameters
callback ( function )
Results
error ( error )
Page.addScriptToEvaluateOnLoad(scriptSource, callback)
Parameters
scriptSource ( string )
callback ( function )
Results
error ( error )
identifier ( ScriptIdentifier )
Identifier of the added script.
Page.removeScriptToEvaluateOnLoad(ScriptIdentifier, callback)
Parameters
identifier ( ScriptIdentifier )
callback ( function )
Results
error ( error )
Page.reload([ignoreCache], [scriptToEvaluateOnLoad], callback)
Reloads given page optionally ignoring the cache.
Parameters
ignoreCache ( optional boolean )
If true, browser cache is ignored (as if the user pressed Shift+refresh).
scriptToEvaluateOnLoad ( optional string )
If set, the script will be injected into all frames of the inspected page after reload.
callback ( function )
Results
error ( error )
Page.navigate(url, callback)
Navigates current page to the given URL.
Parameters
url ( string )
URL to navigate the page to.
callback ( function )
Results
error ( error )
Page.getCookies(callback)
Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies field.
Parameters
callback ( function )
Results
error ( error )
cookies ( array of Cookie )
Array of cookie objects.
Page.deleteCookie(cookieName, url, callback)
Deletes browser cookie with given name, domain and path.
Parameters
cookieName ( string )
Name of the cookie to remove.
url ( string )
URL to match cooke domain and path.
callback ( function )
Results
error ( error )
Page.getResourceTree(callback)
Returns present frame / resource tree structure.
Parameters
callback ( function )
Results
error ( error )
frameTree ( FrameResourceTree )
Present frame / resource tree structure.
Page.getResourceContent(Network.FrameId, url, callback)
Returns content of the given resource.
Parameters
frameId ( Network.FrameId )
Frame id to get resource for.
url ( string )
URL of the resource to get content for.
callback ( function )
Results
error ( error )
content ( string )
Resource content.
base64Encoded ( boolean )
True, if content was served as base64.
Page.searchInResource(Network.FrameId, url, query, [caseSensitive], [isRegex], callback)
Searches for given string in resource content.
Parameters
frameId ( Network.FrameId )
Frame id for resource to search in.
url ( string )
URL of the resource to search in.
query ( string )
String to search for.
caseSensitive ( optional boolean )
If true, search is case sensitive.
isRegex ( optional boolean )
If true, treats string parameter as regex.
callback ( function )
Results
error ( error )
result ( array of GenericTypes.SearchMatch )
List of search matches.
Page.searchInResources(text, [caseSensitive], [isRegex], callback)
Searches for given string in frame / resource tree structure.
Parameters
text ( string )
String to search for.
caseSensitive ( optional boolean )
If true, search is case sensitive.
isRegex ( optional boolean )
If true, treats string parameter as regex.
callback ( function )
Results
error ( error )
result ( array of SearchResult )
List of search results.
Page.setDocumentContent(Network.FrameId, html, callback)
Sets given markup as the document's HTML.
Parameters
frameId ( Network.FrameId )
Frame id to set HTML for.
html ( string )
HTML content to set.
callback ( function )
Results
error ( error )
Page.setShowPaintRects(result, callback)
Requests that backend shows paint rectangles
Parameters
result ( boolean )
True for showing paint rectangles
callback ( function )
Results
error ( error )
Page.getScriptExecutionStatus(callback)
Determines if scripts can be executed in the page.
Parameters
callback ( function )
Results
error ( error )
result ( string enumerated ["allowed","disabled","forbidden"] )
Script execution status: "allowed" if scripts can be executed, "disabled" if script execution has been disabled through page settings, "forbidden" if script execution for the given page is not possible for other reasons.
Page.setScriptExecutionDisabled(value, callback)
Switches script execution in the page.
Parameters
value ( boolean )
Whether script execution should be disabled in the page.
callback ( function )
Results
error ( error )
Page.setTouchEmulationEnabled(enabled, callback)
Toggles mouse event-based touch event emulation.
Parameters
enabled ( boolean )
Whether the touch event emulation should be enabled.
callback ( function )
Results
error ( error )
Page.setEmulatedMedia(media, callback)
Emulates the given media for CSS media queries.
Parameters
media ( string )
Media type to emulate. Empty string disables the override.
callback ( function )
Results
error ( error )
Page.getCompositingBordersVisible(callback)
Indicates the visibility of compositing borders.
Parameters
callback ( function )
Results
error ( error )
result ( boolean )
If true, compositing borders are visible.
Page.setCompositingBordersVisible(visible, callback)
Controls the visibility of compositing borders.
Parameters
visible ( boolean )
True for showing compositing borders.
callback ( function )
Results
error ( error )
Page.snapshotNode(DOM.NodeId, callback)
Capture a snapshot of the specified node that does not include unrelated layers.
Parameters
nodeId ( DOM.NodeId )
Id of the node to snapshot.
callback ( function )
Results
error ( error )
dataURL ( string )
Base64-encoded image data (PNG).
Page.snapshotRect(x, y, width, height, CoordinateSystem, callback)
Capture a snapshot of the page within the specified rectangle and coordinate system.
Parameters
x ( integer )
X coordinate
y ( integer )
Y coordinate
width ( integer )
Rectangle width
height ( integer )
Rectangle height
coordinateSystem ( CoordinateSystem )
Indicates the coordinate system of the supplied rectangle.
callback ( function )
Results
error ( error )
dataURL ( string )
Base64-encoded image data (PNG).
Page.handleJavaScriptDialog(accept, [promptText], callback)
Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
Parameters
accept ( boolean )
Whether to accept or dismiss the dialog.
promptText ( optional string )
The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.
callback ( function )
Results
error ( error )
Page.archive(callback)
Grab an archive of the page.
Parameters
callback ( function )
Results
error ( error )
data ( string )
Base64-encoded web archive.
Events
Event: domContentEventFired
Results
timestamp ( number )
Event: loadEventFired
Results
timestamp ( number )
Event: frameNavigated
Fired once navigation of the frame has completed. Frame is now associated with the new loader.
Results
frame ( Frame )
Frame object.
Event: frameDetached
Fired when frame has been detached from its parent.
Results
frameId ( Network.FrameId )
Id of the frame that has been detached.
Event: frameStartedLoading
Fired when frame has started loading.
Results
frameId ( Network.FrameId )
Id of the frame that has started loading.
Event: frameStoppedLoading
Fired when frame has stopped loading.
Results
frameId ( Network.FrameId )
Id of the frame that has stopped loading.
Event: frameScheduledNavigation
Fired when frame schedules a potential navigation.
Results
frameId ( Network.FrameId )
Id of the frame that has scheduled a navigation.
delay ( number )
Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start.
Event: frameClearedScheduledNavigation
Fired when frame no longer has a scheduled navigation.
Results
frameId ( Network.FrameId )
Id of the frame that has cleared its scheduled navigation.
Event: javascriptDialogOpening
Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.
Results
message ( string )
Message that will be displayed by the dialog.
Event: javascriptDialogClosed
Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed.
Event: scriptsEnabled
Fired when the JavaScript is enabled/disabled on the page
Results
isEnabled ( boolean )
Whether script execution is enabled or disabled on the page.
Types
Class: ResourceType
Type: string
Resource type as it was perceived by the rendering engine.
Class: CoordinateSystem
Type: string
Coordinate system used by supplied coordinates.
Class: Frame
Type: object
Information about the Frame on the page.
Properties
id ( string )
Frame unique identifier.
parentId ( optional string )
Parent frame identifier.
loaderId ( Network.LoaderId )
Identifier of the loader associated with this frame.
name ( optional string )
Frame's name as specified in the tag.
url ( string )
Frame document's URL.
securityOrigin ( string )
Frame document's security origin.
mimeType ( string )
Frame document's mimeType as determined by the browser.
Class: FrameResource
Type: object
Properties
url ( string )
Resource URL.
type ( ResourceType )
Type of this resource.
mimeType ( string )
Resource mimeType as determined by the browser.
failed ( optional boolean )
True if the resource failed to load.
canceled ( optional boolean )
True if the resource was canceled during loading.
sourceMapURL ( optional string )
URL of source map associated with this resource (if any).
Class: FrameResourceTree
Type: object
Information about the Frame hierarchy along with their cached resources.
Properties
frame ( Frame )
Frame information for this tree item.
childFrames ( optional array of FrameResourceTree )
Child frames.
resources ( array of FrameResource )
Information about frame resources.
Class: SearchResult
Type: object
Search result for resource.
Properties
url ( string )
Resource URL.
frameId ( Network.FrameId )
Resource frame id.
matchesCount ( number )
Number of matches in the resource content.
Class: Cookie
Type: object
Cookie object
Properties
name ( string )
Cookie name.
value ( string )
Cookie value.
domain ( string )
Cookie domain.
path ( string )
Cookie path.
expires ( number )
Cookie expires.
size ( integer )
Cookie size.
httpOnly ( boolean )
True if cookie is http-only.
secure ( boolean )
True if cookie is secure.
session ( boolean )
True in case of session cookie.
Class: ScriptIdentifier
Type: string
Unique script identifier.