Page.setRequestInterception() method
Activating request interception enables HTTPRequest.abort() , HTTPRequest.continue() and HTTPRequest.respond() methods. This provides the capability to modify network requests that are made by a page.
Once request interception is enabled, every request will stall unless it's continued, responded or aborted; or completed using the browser cache.
-
See the Request interception guide for more details.
+
See the Request interception guide for more details.
Signature:​
class Page { abstract setRequestInterception ( value : boolean ) : Promise < void > ; }
Parameters​
diff --git a/next/api/puppeteer.page.setuseragent/index.html b/next/api/puppeteer.page.setuseragent/index.html
index 4906c200d9b..1acaa1fa001 100644
--- a/next/api/puppeteer.page.setuseragent/index.html
+++ b/next/api/puppeteer.page.setuseragent/index.html
@@ -6,7 +6,7 @@
Page.setUserAgent() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.setviewport/index.html b/next/api/puppeteer.page.setviewport/index.html
index 78db687006e..8c5b1d119cc 100644
--- a/next/api/puppeteer.page.setviewport/index.html
+++ b/next/api/puppeteer.page.setviewport/index.html
@@ -6,7 +6,7 @@
Page.setViewport() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.tap/index.html b/next/api/puppeteer.page.tap/index.html
index 30d438c4972..94c1d4170d2 100644
--- a/next/api/puppeteer.page.tap/index.html
+++ b/next/api/puppeteer.page.tap/index.html
@@ -6,7 +6,7 @@
Page.tap() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.target/index.html b/next/api/puppeteer.page.target/index.html
index 715112eef0d..27dea71fc65 100644
--- a/next/api/puppeteer.page.target/index.html
+++ b/next/api/puppeteer.page.target/index.html
@@ -6,7 +6,7 @@
Page.target() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.title/index.html b/next/api/puppeteer.page.title/index.html
index c2860137763..73c24a963e3 100644
--- a/next/api/puppeteer.page.title/index.html
+++ b/next/api/puppeteer.page.title/index.html
@@ -6,7 +6,7 @@
Page.title() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.type/index.html b/next/api/puppeteer.page.type/index.html
index 9412dd8f039..28f10fe4ab2 100644
--- a/next/api/puppeteer.page.type/index.html
+++ b/next/api/puppeteer.page.type/index.html
@@ -6,7 +6,7 @@
Page.type() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.url/index.html b/next/api/puppeteer.page.url/index.html
index bef0904c7eb..d6abd6f586e 100644
--- a/next/api/puppeteer.page.url/index.html
+++ b/next/api/puppeteer.page.url/index.html
@@ -6,7 +6,7 @@
Page.url() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.viewport/index.html b/next/api/puppeteer.page.viewport/index.html
index 6bf736ca5ac..4ad1b2ee2c6 100644
--- a/next/api/puppeteer.page.viewport/index.html
+++ b/next/api/puppeteer.page.viewport/index.html
@@ -6,7 +6,7 @@
Page.viewport() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.waitfordeviceprompt/index.html b/next/api/puppeteer.page.waitfordeviceprompt/index.html
index 0b45e9a3bae..35e25c479de 100644
--- a/next/api/puppeteer.page.waitfordeviceprompt/index.html
+++ b/next/api/puppeteer.page.waitfordeviceprompt/index.html
@@ -6,7 +6,7 @@
Page.waitForDevicePrompt() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.waitforfilechooser/index.html b/next/api/puppeteer.page.waitforfilechooser/index.html
index a6ae4b06f32..87537722181 100644
--- a/next/api/puppeteer.page.waitforfilechooser/index.html
+++ b/next/api/puppeteer.page.waitforfilechooser/index.html
@@ -6,7 +6,7 @@
Page.waitForFileChooser() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.waitforframe/index.html b/next/api/puppeteer.page.waitforframe/index.html
index 46188c6b4d6..ac277096c5b 100644
--- a/next/api/puppeteer.page.waitforframe/index.html
+++ b/next/api/puppeteer.page.waitforframe/index.html
@@ -6,7 +6,7 @@
Page.waitForFrame() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.waitforfunction/index.html b/next/api/puppeteer.page.waitforfunction/index.html
index b760fd73181..e3748125cba 100644
--- a/next/api/puppeteer.page.waitforfunction/index.html
+++ b/next/api/puppeteer.page.waitforfunction/index.html
@@ -6,7 +6,7 @@
Page.waitForFunction() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.waitfornavigation/index.html b/next/api/puppeteer.page.waitfornavigation/index.html
index 502ca1372a4..2cccecee4fd 100644
--- a/next/api/puppeteer.page.waitfornavigation/index.html
+++ b/next/api/puppeteer.page.waitfornavigation/index.html
@@ -6,7 +6,7 @@
Page.waitForNavigation() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.waitfornetworkidle/index.html b/next/api/puppeteer.page.waitfornetworkidle/index.html
index 31011ada44e..2d34d80f07e 100644
--- a/next/api/puppeteer.page.waitfornetworkidle/index.html
+++ b/next/api/puppeteer.page.waitfornetworkidle/index.html
@@ -6,7 +6,7 @@
Page.waitForNetworkIdle() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.waitforrequest/index.html b/next/api/puppeteer.page.waitforrequest/index.html
index 0979aa4e482..46d96a3eff3 100644
--- a/next/api/puppeteer.page.waitforrequest/index.html
+++ b/next/api/puppeteer.page.waitforrequest/index.html
@@ -6,7 +6,7 @@
Page.waitForRequest() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.waitforresponse/index.html b/next/api/puppeteer.page.waitforresponse/index.html
index 6616ee306ab..589f43b5c62 100644
--- a/next/api/puppeteer.page.waitforresponse/index.html
+++ b/next/api/puppeteer.page.waitforresponse/index.html
@@ -6,7 +6,7 @@
Page.waitForResponse() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.waitforselector/index.html b/next/api/puppeteer.page.waitforselector/index.html
index 4c2096e207f..00ee6506250 100644
--- a/next/api/puppeteer.page.waitforselector/index.html
+++ b/next/api/puppeteer.page.waitforselector/index.html
@@ -6,7 +6,7 @@
Page.waitForSelector() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page.workers/index.html b/next/api/puppeteer.page.workers/index.html
index a213e25af32..74b799a2a92 100644
--- a/next/api/puppeteer.page.workers/index.html
+++ b/next/api/puppeteer.page.workers/index.html
@@ -6,7 +6,7 @@
Page.workers() method | Puppeteer
-
+
diff --git a/next/api/puppeteer.page/index.html b/next/api/puppeteer.page/index.html
index df94ada639b..fd1aa0ff92f 100644
--- a/next/api/puppeteer.page/index.html
+++ b/next/api/puppeteer.page/index.html
@@ -6,7 +6,7 @@
Page class | Puppeteer
-
+
@@ -56,6 +56,6 @@
page.waitForNavigation(options)
-
setDefaultTimeout(timeout) setDragInterception(enabled) deprecated
Deprecated:
We no longer support intercepting drag payloads. Use the new drag APIs found on ElementHandle to drag (or just use the Page.mouse ).
The extra HTTP headers will be sent with every request the page initiates.
All HTTP header names are lowercased. (HTTP headers are case-insensitive, so this shouldn’t impact your server code.)
page.setExtraHTTPHeaders does not guarantee the order of headers in the outgoing requests.
setGeolocation(options) Sets the page's geolocation.
setJavaScriptEnabled(enabled) setOfflineMode(enabled) Sets the network connection to offline.
It does not change the parameters used in Page.emulateNetworkConditions()
setRequestInterception(value) Activating request interception enables HTTPRequest.abort() , HTTPRequest.continue() and HTTPRequest.respond() methods. This provides the capability to modify network requests that are made by a page.
Once request interception is enabled, every request will stall unless it's continued, responded or aborted; or completed using the browser cache.
See the Request interception guide for more details.
setUserAgent(userAgent, userAgentMetadata) setViewport(viewport) page.setViewport
will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport before navigating to the page.
In the case of multiple pages in a single browser, each page can have its own viewport size.
tap(selector) This method fetches an element with selector
, scrolls it into view if needed, and then uses Page.touchscreen to tap in the center of the element. If there's no element matching selector
, the method throws an error.
target() deprecated
A target this page was created from.
Deprecated:
Use Page.createCDPSession() directly.
title() The page's title
type(selector, text, options) Sends a keydown
, keypress/input
, and keyup
event for each character in the text.
To press a special key, like Control
or ArrowDown
, use Keyboard.press() .
url() The page's URL.
viewport() Returns the current page viewport settings without checking the actual page viewport.
This is either the viewport set with the previous Page.setViewport() call or the default viewport set via BrowserConnectOptions.defaultViewport .
waitForDevicePrompt(options) This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth.
This must be called before the device request is made. It will not return a currently active device prompt.
waitForFileChooser(options) This method is typically coupled with an action that triggers file choosing.
This must be called before the file chooser is launched. It will not return a currently active file chooser.
waitForFrame(urlOrPredicate, options) Waits for a frame matching the given conditions to appear.
waitForFunction(pageFunction, options, args) Waits for the provided function, pageFunction
, to return a truthy value when evaluated in the page's context.
waitForNavigation(options) Waits for the page to navigate to a new URL or to reload. It is useful when you run code that will indirectly cause the page to navigate.
waitForNetworkIdle(options) Waits for the network to be idle.
waitForRequest(urlOrPredicate, options) waitForResponse(urlOrPredicate, options) waitForSelector(selector, options) Wait for the selector
to appear in page. If at the moment of calling the method the selector
already exists, the method will return immediately. If the selector
doesn't appear after the timeout
milliseconds of waiting, the function will throw.
workers() All of the dedicated WebWorkers associated with the page.