mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
94 lines
79 KiB
HTML
94 lines
79 KiB
HTML
<!doctype html>
|
||
<html lang="en" dir="ltr" class="docs-wrapper docs-doc-page docs-version-20.3.0 plugin-docs plugin-id-default docs-doc-id-contributing">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="generator" content="Docusaurus v2.4.0">
|
||
<title data-rh="true">Contributing | Puppeteer</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://pptr.dev/contributing"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docsearch:counter" content="2"><meta data-rh="true" property="og:title" content="Contributing | Puppeteer"><meta data-rh="true" name="description" content="First of all, thank you for your interest in Puppeteer! We'd love to accept your"><meta data-rh="true" property="og:description" content="First of all, thank you for your interest in Puppeteer! We'd love to accept your"><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://pptr.dev/contributing"><link data-rh="true" rel="alternate" href="https://pptr.dev/contributing" hreflang="en"><link data-rh="true" rel="alternate" href="https://pptr.dev/contributing" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://DVKY664LG7-dsn.algolia.net" crossorigin="anonymous"><link rel="search" type="application/opensearchdescription+xml" title="Puppeteer" href="/opensearch.xml">
|
||
|
||
<script src="/fix-location.js"></script><link rel="stylesheet" href="/assets/css/styles.a9d1367f.css">
|
||
<link rel="preload" href="/assets/js/runtime~main.34169386.js" as="script">
|
||
<link rel="preload" href="/assets/js/main.9b762598.js" as="script">
|
||
</head>
|
||
<body class="navigation-with-keyboard">
|
||
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
|
||
<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png" alt="Puppeteer Logo" class="themedImage_ToTc themedImage--light_HNdA"><img src="https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png" alt="Puppeteer Logo" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Puppeteer</b></a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/">Docs</a><a class="navbar__item navbar__link" href="/api/puppeteer.puppeteernode">Puppeteer API</a><a class="navbar__item navbar__link" href="/browsers-api/">@puppeteer/browsers API</a></div><div class="navbar__items navbar__items--right"><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/">20.3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/next/contributing">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/contributing">20.3.0</a></li><li><hr class="dropdown-separator"></li><li class="dropdown-archived-versions"><b>Archived versions</b></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v20.2.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">20.2.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v20.2.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">20.2.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v20.1.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">20.1.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v20.1.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">20.1.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v20.1.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">20.1.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v20.0.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">20.0.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.11.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.11.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.11.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.11.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.10.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.10.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.10.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.10.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.9.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.9.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.9.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.9.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.8.5/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.8.5<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.8.4/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.8.4<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.8.3/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.8.3<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.8.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.8.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.8.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.8.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.8.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.8.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.7.5/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.7.5<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.7.4/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.7.4<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.7.3/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.7.3<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.7.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.7.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.7.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.7.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.7.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.7.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.6.3/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.6.3<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.6.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.6.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.6.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.6.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.6.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.6.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.5.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.5.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.5.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.5.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.5.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.5.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.4.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.4.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.4.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.4.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v19.3.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.3.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v19.2.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.2.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v19.2.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.2.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v19.2.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.2.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v19.1.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.1.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v19.1.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.1.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v19.1.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.1.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v19.0.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">19.0.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v18.2.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">18.2.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v18.2.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">18.2.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v18.1.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">18.1.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v18.0.5/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">18.0.5<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v18.0.4/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">18.0.4<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v18.0.3/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">18.0.3<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v18.0.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">18.0.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v18.0.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">18.0.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v18.0.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">18.0.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v17.1.3/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">17.1.3<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v17.1.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">17.1.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v17.1.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">17.1.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v17.1.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">17.1.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v17.0.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">17.0.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v16.2.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">16.2.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v16.1.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">16.1.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v16.1.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">16.1.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/v16.0.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">16.0.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v15.5.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">15.5.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v15.4.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">15.4.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v15.4.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">15.4.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v15.4.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">15.4.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v15.3.2/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">15.3.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v15.3.1/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">15.3.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/puppeteer/puppeteer/blob/puppeteer-v15.3.0/docs/api/index.md" target="_blank" rel="noopener noreferrer" class="dropdown__link">15.3.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><a href="https://github.com/puppeteer/puppeteer" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-github-link" aria-label="GitHub repository"></a><div class="toggle_vylO colorModeToggle_DEke"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Puppeteer</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="true" href="/category/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/guides/configuration">Configuration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/guides/query-selectors">Query Selectors</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/guides/evaluate-javascript">Evaluate JavaScript</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/guides/docker">Docker</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/guides/request-interception">Request Interception</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/guides/chrome-extensions">Chrome Extensions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/guides/debugging">Debugging</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/chromium-support">Chromium Support</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/troubleshooting">Troubleshooting</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/contributing">Contributing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/faq">FAQ</a></li></ul></nav></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Contributing</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 20.3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><h1>Contributing</h1><p>First of all, thank you for your interest in Puppeteer! We'd love to accept your
|
||
patches and contributions!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="contributor-license-agreement">Contributor License Agreement<a href="#contributor-license-agreement" class="hash-link" aria-label="Direct link to Contributor License Agreement" title="Direct link to Contributor License Agreement"></a></h2><p>Contributions to this project must be accompanied by a Contributor License
|
||
Agreement. You (or your employer) retain the copyright to your contribution,
|
||
this simply gives us permission to use and redistribute your contributions as
|
||
part of the project. Head over to <a href="https://cla.developers.google.com/" target="_blank" rel="noopener noreferrer">https://cla.developers.google.com/</a> to see
|
||
your current agreements on file or to sign a new one.</p><p>You generally only need to submit a CLA once, so if you've already submitted one
|
||
(even if it was for a different project), you probably don't need to do it
|
||
again.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="getting-started">Getting started<a href="#getting-started" class="hash-link" aria-label="Direct link to Getting started" title="Direct link to Getting started"></a></h2><ol><li><p>Clone this repository</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">git</span><span class="token plain"> clone https://github.com/puppeteer/puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin class-name">cd</span><span class="token plain"> puppeteer</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>or</p><p><a href="https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=90796663&machine=standardLinux32gb&devcontainer_path=.devcontainer%2Fdevcontainer.json" target="_blank" rel="noopener noreferrer"><img loading="lazy" src="https://github.com/codespaces/badge.svg" alt="Open in GitHub Codespaces" class="img_ev3q"></a></p></li><li><p>Install the dependencies</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Or to download Firefox</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token assign-left variable" style="color:#36acaa">PUPPETEER_PRODUCT</span><span class="token operator" style="color:#393A34">=</span><span class="token plain">firefox </span><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Build all packages</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> run build</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>Run all tests</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token builtin class-name">test</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ol><h2 class="anchor anchorWithStickyNavbar_LWe7" id="building-a-single-package">Building a single package<a href="#building-a-single-package" class="hash-link" aria-label="Direct link to Building a single package" title="Direct link to Building a single package"></a></h2><p>To build a single package, you can run:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> run build --workspace </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">package</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic"># e.g. puppeteer</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This will build all dependent packages automatically, so specifying a single
|
||
packages is sufficient. This is all possible due to
|
||
<a href="https://github.com/google/wireit" target="_blank" rel="noopener noreferrer">wireit</a> which behaves similar to
|
||
<a href="https://www.gnu.org/software/make/" target="_blank" rel="noopener noreferrer">GNU Make</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="watch-mode">Watch mode<a href="#watch-mode" class="hash-link" aria-label="Direct link to Watch mode" title="Direct link to Watch mode"></a></h3><p>To continuously build a package, you can run:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> run build --watch --workspace </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">package</span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic"># e.g. puppeteer</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>You have to only specify a single package to watch else things will not work as expected
|
||
As stated above because of <a href="https://github.com/google/wireit" target="_blank" rel="noopener noreferrer">wireit</a> when a change happens
|
||
all dependencies will be build or rebuild (if needed).</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removing-stale-artifacts">Removing stale artifacts<a href="#removing-stale-artifacts" class="hash-link" aria-label="Direct link to Removing stale artifacts" title="Direct link to Removing stale artifacts"></a></h2><p>It's possible some generated artifacts (such as
|
||
<code>packages/puppeteer-core/src/types.ts</code>) can become stale since these artifacts
|
||
rely on complex conditions (such as names of distinct files) that cannot be
|
||
captured by the build system. To clean artifacts, you can run</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> run clean</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># or specify the package</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> run clean --workspace </span><span class="token operator" style="color:#393A34"><</span><span class="token plain">package</span><span class="token operator" style="color:#393A34">></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="comprehensive-testing">Comprehensive testing<a href="#comprehensive-testing" class="hash-link" aria-label="Direct link to Comprehensive testing" title="Direct link to Comprehensive testing"></a></h2><p>Outside of <code>npm test</code>, there are several other
|
||
<a href="https://docs.npmjs.com/cli/using-npm/scripts" target="_blank" rel="noopener noreferrer"><code>npm</code> scripts</a> that are
|
||
usually check through CI:</p><ul><li><code>test-install</code> - Tests whether <code>puppeteer</code> and <code>puppeteer-core</code> install
|
||
properly and are functional.</li><li><code>test-types</code> - Tests the TypeScript types in <code>puppeteer</code> using
|
||
<a href="https://github.com/SamVerschueren/tsd" target="_blank" rel="noopener noreferrer"><code>tsd</code></a>.</li><li><code>test:chrome:**</code> - Tests <code>puppeteer</code> on Chromium.</li><li><code>test:firefox:**</code> - Tests <code>puppeteer</code> on Firefox.</li></ul><p>The default <code>npm test</code> runs <code>test:{chrome,firefox}:headless</code> which is generally
|
||
sufficient.</p><p>Puppeteer uses a custom test runner on top of Mocha that consults the
|
||
<a href="https://github.com/puppeteer/puppeteer/blob/main/test/TestExpectations.json" target="_blank" rel="noopener noreferrer">TestExpectations.json</a>
|
||
to see if a given test result is expected or not. See more info about the test
|
||
runner in
|
||
<a href="https://github.com/puppeteer/puppeteer/tree/main/tools/mochaRunner" target="_blank" rel="noopener noreferrer"><code>tools/mochaRunner</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="code-reviews">Code reviews<a href="#code-reviews" class="hash-link" aria-label="Direct link to Code reviews" title="Direct link to Code reviews"></a></h2><p>All submissions, including submissions by project members, require review. We
|
||
use GitHub pull requests for this purpose. Consult
|
||
<a href="https://help.github.com/articles/about-pull-requests/" target="_blank" rel="noopener noreferrer">GitHub Help</a> for more
|
||
information on using pull requests.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="code-style">Code Style<a href="#code-style" class="hash-link" aria-label="Direct link to Code Style" title="Direct link to Code Style"></a></h2><p>Our coding style is fully defined in
|
||
<a href="https://github.com/puppeteer/puppeteer/blob/main/.eslintrc.js" target="_blank" rel="noopener noreferrer"><code>.eslintrc</code></a>
|
||
(<a href="https://eslint.org/" target="_blank" rel="noopener noreferrer">ESLint</a>) and
|
||
<a href="https://github.com/puppeteer/puppeteer/blob/main/.prettierrc.cjs" target="_blank" rel="noopener noreferrer"><code>.prettierrc.cjs</code></a>
|
||
(<a href="https://prettier.io" target="_blank" rel="noopener noreferrer">Prettier</a>).</p><p>Code is checked during <code>pre-push</code> using
|
||
<a href="https://typicode.github.io/husky/#/" target="_blank" rel="noopener noreferrer">Husky</a>, but you can check your code
|
||
manually by running:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> run lint</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>If some errors are returned, you can attempt to fix them using:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> run </span><span class="token function" style="color:#d73a49">format</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="project-structure">Project structure<a href="#project-structure" class="hash-link" aria-label="Direct link to Project structure" title="Direct link to Project structure"></a></h2><p>The following is a description of the primary folders in Puppeteer:</p><ul><li><code>packages</code> contains all public source code.</li><li><code>test</code> contains all test source code.</li><li><code>test-d</code> contains type tests using
|
||
<a href="https://github.com/SamVerschueren/tsd" target="_blank" rel="noopener noreferrer"><code>tsd</code></a>.</li><li><code>tools</code> contains miscellaneous scripts that are used in building and etc.</li><li><code>tools/mochaRunner</code> - contains the source code for our test runner.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="api-guidelines">API guidelines<a href="#api-guidelines" class="hash-link" aria-label="Direct link to API guidelines" title="Direct link to API guidelines"></a></h2><p>When authoring new API methods, consider the following:</p><ul><li>Expose as little information as needed. When in doubt, don’t expose new
|
||
information.</li><li>Methods are used in favor of getters/setters.<ul><li>The only exception is namespaces, e.g. <code>page.keyboard</code> and <code>page.coverage</code></li></ul></li><li>All string literals must be small case. This includes event names and option
|
||
values.</li><li>Avoid adding "sugar" API (API that is trivially implementable in user-space)
|
||
unless they're <strong>extremely</strong> demanded.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="commit-messages">Commit messages<a href="#commit-messages" class="hash-link" aria-label="Direct link to Commit messages" title="Direct link to Commit messages"></a></h2><p>Commit messages should follow
|
||
<a href="https://www.conventionalcommits.org/en/v1.0.0/#summary" target="_blank" rel="noopener noreferrer">the Conventional Commits format</a>.
|
||
This is enforced via <code>npm run commitlint</code>.</p><p>In particular, breaking changes should clearly be noted as “BREAKING CHANGE:” in
|
||
the commit message footer. Example:</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">fix(page): fix page.pizza method</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">This patch fixes page.pizza so that it works with iframes.</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Issues: #123, #234</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">BREAKING CHANGE: page.pizza now delivers pizza at home by default.</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">To deliver to a different location, use the "deliver" option:</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> `page.pizza({deliver: 'work'})`.</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="writing-documentation">Writing documentation<a href="#writing-documentation" class="hash-link" aria-label="Direct link to Writing documentation" title="Direct link to Writing documentation"></a></h2><p>Documentation is generated from TSDoc comments via <code>npm run docs</code>. It is automatically
|
||
published to our documentation site on merge and gets versioned on release.</p><p>This means that you should not change the markdown in files <code>docs/api</code> manually.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="writing-tsdoc-comments">Writing TSDoc comments<a href="#writing-tsdoc-comments" class="hash-link" aria-label="Direct link to Writing TSDoc comments" title="Direct link to Writing TSDoc comments"></a></h2><p>Each change to Puppeteer should be thoroughly documented using TSDoc comments.
|
||
Refer to the
|
||
<a href="https://api-extractor.com/pages/tsdoc/doc_comment_syntax/" target="_blank" rel="noopener noreferrer">API Extractor documentation</a>
|
||
for information on the exact syntax.</p><ul><li>Every new method needs to have either <code>@public</code> or <code>@internal</code> added as a tag
|
||
depending on if it is part of the public API.</li><li>Keep each line in a comment to no more than 90 characters (ESLint will warn
|
||
you if you go over this). If you're a VSCode user the
|
||
<a href="https://marketplace.visualstudio.com/items?itemName=stkb.rewrap" target="_blank" rel="noopener noreferrer">Rewrap plugin</a>
|
||
is highly recommended!</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="running-the-documentation-site-locally">Running the documentation site locally<a href="#running-the-documentation-site-locally" class="hash-link" aria-label="Direct link to Running the documentation site locally" title="Direct link to Running the documentation site locally"></a></h2><ol><li>At root, install all dependencies with <code>npm i --ignore-scripts</code>.</li><li>run <code>npm run docs</code> which will generate all the <code>.md</code> files on
|
||
<code>puppeteer/docs/api</code>.</li><li>run <code>npm i</code> in <code>puppeteer/website</code>.</li><li>run <code>npm start</code> in <code>puppeteer/website</code>.</li></ol><h2 class="anchor anchorWithStickyNavbar_LWe7" id="adding-new-dependencies">Adding new dependencies<a href="#adding-new-dependencies" class="hash-link" aria-label="Direct link to Adding new dependencies" title="Direct link to Adding new dependencies"></a></h2><p>For all dependencies (both installation and development):</p><ul><li><strong>Do not add</strong> a dependency if the desired functionality is easily
|
||
implementable.</li><li>If adding a dependency, it should be well-maintained and trustworthy.</li></ul><p>A barrier for introducing new installation dependencies is especially high:</p><ul><li><strong>Do not add</strong> installation dependency unless it's critical to project
|
||
success.</li></ul><p>There are additional considerations for dependencies that are environment
|
||
agonistic. See the
|
||
<a href="https://github.com/puppeteer/puppeteer/blob/main/third_party/README.md" target="_blank" rel="noopener noreferrer"><code>third_party/README.md</code></a>
|
||
for details.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="testing-tips">Testing tips<a href="#testing-tips" class="hash-link" aria-label="Direct link to Testing tips" title="Direct link to Testing tips"></a></h2><ul><li>Every feature should be accompanied by a test.</li><li>Every public api event/method should be accompanied by a test.</li><li>Tests should not depend on external services.</li><li>Tests should work on all three platforms: Mac, Linux and Win. This is
|
||
especially important for screenshot tests.</li></ul><p>If a test is expected to fail on certain configurations or became flaky, update
|
||
<a href="https://github.com/puppeteer/puppeteer/blob/main/test/TestExpectations.json" target="_blank" rel="noopener noreferrer">TestExpectations.json</a>
|
||
to reflect that. See more info about TestExpectations.json in
|
||
<a href="https://github.com/puppeteer/puppeteer/tree/main/tools/mochaRunner" target="_blank" rel="noopener noreferrer"><code>tools/mochaRunner</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="api-coverage">API Coverage<a href="#api-coverage" class="hash-link" aria-label="Direct link to API Coverage" title="Direct link to API Coverage"></a></h2><p>Every public API method or event should be called at least once in tests. To
|
||
ensure this, the main <code>test</code> command runs coverage during testing.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="debugging-puppeteer">Debugging Puppeteer<a href="#debugging-puppeteer" class="hash-link" aria-label="Direct link to Debugging Puppeteer" title="Direct link to Debugging Puppeteer"></a></h2><p>See <a href="https://pptr.dev/guides/debugging" target="_blank" rel="noopener noreferrer">Debugging Tips</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="debugging-puppeteer-tests-via-vscode">Debugging Puppeteer tests via VSCode<a href="#debugging-puppeteer-tests-via-vscode" class="hash-link" aria-label="Direct link to Debugging Puppeteer tests via VSCode" title="Direct link to Debugging Puppeteer tests via VSCode"></a></h3><p>Copy the provided default <code>.vscode/launch.template.json</code> to <code>.vscode/launch.json</code> and then use the integrated VSCode debugger to debug test.</p><p>Remember to build test before launching via:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> run build --workspace @puppeteer-test/test</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h1>For Project Maintainers</h1><h2 class="anchor anchorWithStickyNavbar_LWe7" id="rolling-new-chrome-version">Rolling new Chrome version<a href="#rolling-new-chrome-version" class="hash-link" aria-label="Direct link to Rolling new Chrome version" title="Direct link to Rolling new Chrome version"></a></h2><p>The following steps are needed to update the Chrome version.</p><ol><li>Find a suitable Chrome revision via <a href="https://googlechromelabs.github.io/chrome-for-testing/" target="_blank" rel="noopener noreferrer">https://googlechromelabs.github.io/chrome-for-testing/</a> or <a href="https://chromiumdash.appspot.com/" target="_blank" rel="noopener noreferrer">https://chromiumdash.appspot.com/</a>.</li><li>Update <code>packages/puppeteer-core/src/revisions.ts</code> with the found version
|
||
number.</li><li>Update <code>versions.js</code> with the new Chrome-to-Puppeteer version mapping and
|
||
update <code>lastMaintainedChromeVersion</code> with the latest stable Chrome version.
|
||
You can find the corresponding version by going to <a href="https://omahaproxy.appspot.com/" target="_blank" rel="noopener noreferrer">omahaproxy.appspot.com</a> then
|
||
searching in <code>Find Releases</code> for <code>r<revision></code>.</li><li>Run <code>npm run check</code>. If it fails, update
|
||
<code>packages/puppeteer-core/package.json</code>
|
||
with the expected <code>devtools-protocol</code> version and run <code>npm install</code> to generate an updated <code>package-lock.json</code>.</li><li>Run <code>npm run clean</code>, <code>npm run build</code> and <code>npm install</code>.</li><li>Run <code>npm test</code> and ensure that all tests pass. If a test fails,
|
||
<a href="#bisecting-upstream-changes">bisect</a> the upstream cause of the failure, and
|
||
either update the test expectations accordingly (if it was an intended
|
||
change) or work around the changes in Puppeteer (if it’s not desirable to
|
||
change Puppeteer’s observable behavior).</li><li>Commit and push your changes and open a pull request. The commit message must
|
||
contain the version in <code>Chrome <version> (r<revision>)</code> format to ensure
|
||
that <a href="https://pptr.dev/" target="_blank" rel="noopener noreferrer">pptr.dev</a> can parse it correctly, e.g.
|
||
<code>'feat(chrome): roll to Chrome 90.0.4427.0 (r856583)'</code>.</li></ol><h3 class="anchor anchorWithStickyNavbar_LWe7" id="bisecting-upstream-changes">Bisecting upstream changes<a href="#bisecting-upstream-changes" class="hash-link" aria-label="Direct link to Bisecting upstream changes" title="Direct link to Bisecting upstream changes"></a></h3><p>For bisecting Chrome/Chromium changes use <a href="https://www.chromium.org/developers/bisect-builds-py/" target="_blank" rel="noopener noreferrer">https://www.chromium.org/developers/bisect-builds-py/</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="releasing-to-npm">Releasing to npm<a href="#releasing-to-npm" class="hash-link" aria-label="Direct link to Releasing to npm" title="Direct link to Releasing to npm"></a></h2><p>We use <a href="https://github.com/googleapis/release-please" target="_blank" rel="noopener noreferrer">release-please</a> to
|
||
automate releases. When a release should be done, check for the release PR in
|
||
our <a href="https://github.com/puppeteer/puppeteer/pulls" target="_blank" rel="noopener noreferrer">pull requests</a> and merge it.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="in-case-release-please-fails">In case Release Please fails<a href="#in-case-release-please-fails" class="hash-link" aria-label="Direct link to In case Release Please fails" title="Direct link to In case Release Please fails"></a></h3><p>In the event release-please fails, the following needs to be done:</p><ol><li><p>Update anything missing in the CHANGELOG of every package that was supposed
|
||
to be published. For example, if the header is missing, you may need to add</p><ul><li><p>For puppeteer:</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token title important punctuation" style="color:#393A34">##</span><span class="token title important"> [{NEW_VERSION}](https://github.com/puppeteer/puppeteer/compare/v{PREVIOUS_VERSION}...v{NEW_VERSION}) ({CURRENT_DATE})`</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li><li><p>For other packages:</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token title important punctuation" style="color:#393A34">##</span><span class="token title important"> [{NEW_VERSION}](https://github.com/puppeteer/puppeteer/compare/{PACKAGE_FOLDER_NAME}-v{PREVIOUS_VERSION}...{PACKAGE_FOLDER_NAME}-v{NEW_VERSION}) ({CURRENT_DATE})</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ul></li><li><p>Create a GitHub release for each package, following the practice of previous
|
||
releases.</p></li></ol><h2 class="anchor anchorWithStickyNavbar_LWe7" id="bug-triage-guidelines">Bug triage guidelines<a href="#bug-triage-guidelines" class="hash-link" aria-label="Direct link to Bug triage guidelines" title="Direct link to Bug triage guidelines"></a></h2><p><a href="https://github.com/puppeteer/puppeteer/issues" target="_blank" rel="noopener noreferrer">Check incoming bug reports</a> that do not have a <code>confirmed</code> or <code>needs-feedback</code> label:</p><ol><li>Make sure the issue is labeled as either <code>bug</code> or <code>feature</code>.</li><li>If the issue does not have a clear repro or you cannot repro, ask for the repro and set the <code>needs-feedback</code> label.</li><li>Follow-up on the issues you previously asked for a feedback on (you should get a notification on GitHub when the user responds).</li><li>If the user does not provide feedback, the issue will be closed by the stale bot eventually.</li><li>If you are able to reproduce the issue, add the label <code>confirmed</code>.</li><li>If the bug is on the Chromium side, create a corresponding crbug.com issue, label the GitHub issue with the <code>upstream</code> label, and post a link to crbug.com in the comments.</li><li>If the issue is not related to either Puppeteer or Chromium, close the issue.</li><li>If the issue is about missing/incorrect documentation, label it as <code>documentation</code>.</li></ol><p>Issues with PDFs:</p><ol><li>If the issue reproduces using the regular print dialog and/or headful, <a href="https://bugs.chromium.org/p/chromium/issues/entry?components=Blink%3ELayout" target="_blank" rel="noopener noreferrer">file a crbug.com against the <code>Blink>Layout</code> component</a>.</li><li>If the issue is specific to Headless mode, <a href="https://bugs.chromium.org/p/chromium/issues/entry?components=Internals%3EHeadless" target="_blank" rel="noopener noreferrer">file an issue on crbug.com against the <code>Internals>Headless</code> component</a>.</li></ol></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/troubleshooting"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Troubleshooting</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/faq"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">FAQ</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#contributor-license-agreement" class="table-of-contents__link toc-highlight">Contributor License Agreement</a></li><li><a href="#getting-started" class="table-of-contents__link toc-highlight">Getting started</a></li><li><a href="#building-a-single-package" class="table-of-contents__link toc-highlight">Building a single package</a><ul><li><a href="#watch-mode" class="table-of-contents__link toc-highlight">Watch mode</a></li></ul></li><li><a href="#removing-stale-artifacts" class="table-of-contents__link toc-highlight">Removing stale artifacts</a></li><li><a href="#comprehensive-testing" class="table-of-contents__link toc-highlight">Comprehensive testing</a></li><li><a href="#code-reviews" class="table-of-contents__link toc-highlight">Code reviews</a></li><li><a href="#code-style" class="table-of-contents__link toc-highlight">Code Style</a></li><li><a href="#project-structure" class="table-of-contents__link toc-highlight">Project structure</a></li><li><a href="#api-guidelines" class="table-of-contents__link toc-highlight">API guidelines</a></li><li><a href="#commit-messages" class="table-of-contents__link toc-highlight">Commit messages</a></li><li><a href="#writing-documentation" class="table-of-contents__link toc-highlight">Writing documentation</a></li><li><a href="#writing-tsdoc-comments" class="table-of-contents__link toc-highlight">Writing TSDoc comments</a></li><li><a href="#running-the-documentation-site-locally" class="table-of-contents__link toc-highlight">Running the documentation site locally</a></li><li><a href="#adding-new-dependencies" class="table-of-contents__link toc-highlight">Adding new dependencies</a></li><li><a href="#testing-tips" class="table-of-contents__link toc-highlight">Testing tips</a></li><li><a href="#api-coverage" class="table-of-contents__link toc-highlight">API Coverage</a></li><li><a href="#debugging-puppeteer" class="table-of-contents__link toc-highlight">Debugging Puppeteer</a><ul><li><a href="#debugging-puppeteer-tests-via-vscode" class="table-of-contents__link toc-highlight">Debugging Puppeteer tests via VSCode</a></li></ul></li><li><a href="#rolling-new-chrome-version" class="table-of-contents__link toc-highlight">Rolling new Chrome version</a><ul><li><a href="#bisecting-upstream-changes" class="table-of-contents__link toc-highlight">Bisecting upstream changes</a></li></ul></li><li><a href="#releasing-to-npm" class="table-of-contents__link toc-highlight">Releasing to npm</a><ul><li><a href="#in-case-release-please-fails" class="table-of-contents__link toc-highlight">In case Release Please fails</a></li></ul></li><li><a href="#bug-triage-guidelines" class="table-of-contents__link toc-highlight">Bug triage guidelines</a></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/puppeteer" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stack Overflow<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://twitter.com/chromedevtools" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://goo.gle/devtools-youtube" target="_blank" rel="noopener noreferrer" class="footer__link-item">YouTube<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2023 Google, Inc.</div></div></div></footer></div>
|
||
<script src="/assets/js/runtime~main.34169386.js"></script>
|
||
<script src="/assets/js/main.9b762598.js"></script>
|
||
</body>
|
||
</html> |