Screenshots
-
For capturing screenshots use Page.screenshot()
.
-
const browser = await puppeteer . launch ( ) ; const page = await browser . newPage ( ) ; await page . goto ( 'https://news.ycombinator.com' , { waitUntil : 'networkidle2' , } ) ; await page . screenshot ( { path : 'hn.pdf' , } ) ; await browser . close ( ) ;
+
For capturing screenshots use Page.screenshot()
.
+
const browser = await puppeteer . launch ( ) ; const page = await browser . newPage ( ) ; await page . goto ( 'https://news.ycombinator.com' , { waitUntil : 'networkidle2' , } ) ; await page . screenshot ( { path : 'hn.png' , } ) ; await browser . close ( ) ;
You can also capture a screenshot of a specific element using ElementHandle.screenshot()
:
const fileElement = await page . waitForSelector ( 'div' ) ; await fileElement . screenshot ( { path : 'div.png' , } ) ;
By default, ElementHandle.screenshot()
tries to scroll the element into view
diff --git a/next/guides/system-requirements/index.html b/next/guides/system-requirements/index.html
index f65ae734282..c6dd0606e1f 100644
--- a/next/guides/system-requirements/index.html
+++ b/next/guides/system-requirements/index.html
@@ -6,7 +6,7 @@
System requirements | Puppeteer
-
+
diff --git a/next/guides/what-is-puppeteer/index.html b/next/guides/what-is-puppeteer/index.html
index 6c516e70a8a..3848c0b91f4 100644
--- a/next/guides/what-is-puppeteer/index.html
+++ b/next/guides/what-is-puppeteer/index.html
@@ -6,7 +6,7 @@
What is Puppeteer? | Puppeteer
-
+
diff --git a/next/index.html b/next/index.html
index ca7614f73a4..92ed8539dc1 100644
--- a/next/index.html
+++ b/next/index.html
@@ -6,7 +6,7 @@
Puppeteer | Puppeteer
-
+
diff --git a/next/supported-browsers/index.html b/next/supported-browsers/index.html
index 534dfbd7f4a..7de8c4826bf 100644
--- a/next/supported-browsers/index.html
+++ b/next/supported-browsers/index.html
@@ -6,7 +6,7 @@
Supported browsers | Puppeteer
-
+
diff --git a/next/troubleshooting/index.html b/next/troubleshooting/index.html
index ae8d32c9ce5..9be595ed1a4 100644
--- a/next/troubleshooting/index.html
+++ b/next/troubleshooting/index.html
@@ -6,7 +6,7 @@
Troubleshooting | Puppeteer
-
+
diff --git a/next/webdriver-bidi/index.html b/next/webdriver-bidi/index.html
index feb5ee9eeb4..59365c6e070 100644
--- a/next/webdriver-bidi/index.html
+++ b/next/webdriver-bidi/index.html
@@ -6,7 +6,7 @@
Experimental WebDriver BiDi support | Puppeteer
-
+
diff --git a/search/index.html b/search/index.html
index 5f1ddd48724..601b0077b9a 100644
--- a/search/index.html
+++ b/search/index.html
@@ -6,7 +6,7 @@
Search the documentation | Puppeteer
-
+
diff --git a/supported-browsers/index.html b/supported-browsers/index.html
index 389099ae2a9..1fba3f11864 100644
--- a/supported-browsers/index.html
+++ b/supported-browsers/index.html
@@ -6,7 +6,7 @@
Supported browsers | Puppeteer
-
+
diff --git a/troubleshooting/index.html b/troubleshooting/index.html
index f27df6565dc..68c1dfc5088 100644
--- a/troubleshooting/index.html
+++ b/troubleshooting/index.html
@@ -6,7 +6,7 @@
Troubleshooting | Puppeteer
-
+
diff --git a/webdriver-bidi/index.html b/webdriver-bidi/index.html
index 54a25d303d5..406d3c68f57 100644
--- a/webdriver-bidi/index.html
+++ b/webdriver-bidi/index.html
@@ -6,7 +6,7 @@
Experimental WebDriver BiDi support | Puppeteer
-
+