Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: puppeteer/puppeteer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.0.1
Choose a base ref
...
head repository: puppeteer/puppeteer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.0.0
Choose a head ref

Commits on Jun 25, 2020

  1. docs(new): migrate Touchscreen docs to TSDoc (#6087)

    Co-authored-by: martinsplitt <martin@geekonaut.de>
    2 people authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    2ad42dc View commit details
  2. docs(new): Adds TSDoc to Mouse class (#6086)

    * Adds tsdoc to Mouse class
    
    * Updates puppeteer class tsdoc
    
    * docs(new): add TSDoc comments to BrowserFetcher (#6078)
    
    * Adds tsdoc for Touchscreen (#6087)
    
    Co-authored-by: martinsplitt <martin@geekonaut.de>
    
    * Adds tsdoc to Mouse class
    
    * Fixes tsdoc comment for Mouse class
    
    Co-authored-by: martinsplitt <martin@geekonaut.de>
    2 people authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    f481922 View commit details
  3. chore: tidy up TODO from TS tests migration (#6090)

    Deleting `Node` errors in strict mode; we don't need to have this test
    any more.
    jackfranklin authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    7855519 View commit details
  4. docs(new): migrate FileChooser docs to TSDoc (#6092)

    Co-authored-by: martinsplitt <martin@geekonaut.de>
    2 people authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    60904da View commit details
  5. docs(new): Adds TSDoc to Tracing class (#6088)

    * Adds tsdoc to Tracing class
    
    * Updates tsdocs
    
    Co-authored-by: martinsplitt <martin@geekonaut.de>
    2 people authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    a46c78f View commit details
  6. Copy the full SHA
    f1f7339 View commit details
  7. docs(new): add TSDoc comments to Puppeteer (#6032) (#6094)

    Co-authored-by: Martin Splitt <mr.avgp@googlemail.com>
    2 people authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    48c5a8e View commit details
  8. Copy the full SHA
    c149034 View commit details
  9. chore(agnostic): Migrate DOMWorld (#6054)

    DOMWorld only needs to use Node's `fs` module if you're adding a
    filepath as a script/style tag. We can detect this case and run the
    `require` inline such that in a browser this code won't execute.
    jackfranklin authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    b993adb View commit details
  10. docs(new): migrate HTTPResponse docs to TSDoc (#6085)

    Co-authored-by: Changhao Han <changhaohan@chromium.org>
    2 people authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    4696f7a View commit details
  11. docs(new): add TSDoc comments to Keyboard (#6099)

    Co-authored-by: Tim van der Lippe <tvanderlippe@google.com>
    2 people authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    5b6d2bf View commit details
  12. chore: remove helper.promisify (#6100)

    It was just re-exporting the built-in Node module so let's just import
    from that directly.
    jackfranklin authored and mathiasbynens committed Jun 25, 2020
    Copy the full SHA
    a4d12a2 View commit details
  13. feat(types): improve typing of .evaluate() (#6096)

    * feat(types): improve typing of `.evaluate()`
    
    This is the start of the work to take the types from the
    `@types/puppeteer` repository and port them into our repo so we can ship
    our built-in types out the box.
    
    This change types the `evaluate` function properly. It takes a generic
    type which is the type of the function you're passing, and the arguments
    and the return that you get back from the `evaluate` call are typed
    correctly.
    jackfranklin authored Jun 25, 2020
    Copy the full SHA
    46fc6ca View commit details
  14. chore(agnostic): ship CJS and ESM builds (#6095)

    * chore(agnostic): ship CJS and ESM builds
    
    For our work to enable Puppeteer in other environments (e.g. a browser)
    we need to ship an ESM build. This commit changes our config to ship to
    `lib/cjs` and `lib/esm` accordingly. The majority of our code stays the
    same, with one small fix for the CJS build to ensure that we ship a
    version that lets you `require('puppeteer')` rather than have to
    `require('puppeteer').default`. We do this with the `cjs-entry.js` which
    is what the `main` field in our `package.json` points to.
    
    We also swap to `read-pkg-up` to find the `package.json` file. This is
    because the folder structure of `lib/` does not match `src/` now we ship
    to `cjs` and `esm`, so you cannot rely on exact paths. This module works
    up from the file to find the nearest `package.json` so it will always
    find Puppeteer's `package.json`.
    
    Note that we *do not* point any users to the ESM build. We happen to
    ship those files so people who know about them can get at them but it's
    not expected (nor will we actively support) that people will rely on
    them. The CommonJS build is considered our main build.
    
    We may make breaking changes to the structure of the ESM build which we
    will do without requiring new major versions. For example the ESM build
    currently ships all files that the CJS build does, but given we are
    working on the ESM build being able to run in the browser this may
    change over time.
    
    Long term once the Node versions catch up we can ditch CJS and ship
    exclusively ESM but we are not there yet.
    jackfranklin authored Jun 25, 2020
    Copy the full SHA
    1c0009d View commit details
  15. Copy the full SHA
    df96f16 View commit details

Commits on Jun 26, 2020

  1. docs(new): migrate Page.ts to TSDoc (part 0 / 2) (#6104)

    * docs(new): migrate Page.ts to TSDoc (part 0 / 2)
    
    Co-authored-by: Changhao Han <changhaohan@chromium.org>
    hanselfmu and hanselfmu-chromium authored Jun 26, 2020
    Copy the full SHA
    adeffba View commit details
  2. docs(api): fix broken links in api.md (#6113)

    Fix broken cross-links to classes HTTPRequest and HTTPResponse.
    Toideng authored Jun 26, 2020
    Copy the full SHA
    3760302 View commit details

Commits on Jun 29, 2020

  1. Copy the full SHA
    123c377 View commit details
  2. chore: Don't store revisions in package.json (#6109)

    * chore: Don't store revisions in `package.json`
    
    It's quite messy to have to require the `package.json` file in multiple
    places purely to find out what revision of a given browser we want to
    use. We can also achieve better type safety by placing it in an actual
    source file.
    
    This commit makes that change and also tidies up our reliance on
    `package.json` within the source code generally; we now only use it to
    find the location of the Puppeteer root such that we know where to
    install downloaded browsers to.
    
    To avoid using `package.json` to parse the name of the module, we also
    now explicitly have an entry point for the Puppeteer module and the
    Puppeter Core module. This will make it easier in the future to ship
    less code as part of core (e.g. core never needs to download a browser,
    so why ship that code?). Core can also then not have any revisions based
    info contained in it.
    
    The test install script has also been updated to ensure that
    puppeteer-core can be installed correctly too.
    
    Finally, the `install` script has been moved to TypeScript for nicer
    typechecking and safety. The functionality of it has not changed.
    jackfranklin authored Jun 29, 2020
    Copy the full SHA
    1f5e333 View commit details

Commits on Jun 30, 2020

  1. chore: fix Firefox install checker (#6129)

    I think when the FF version changes this check breaks - let's just make
    it check that a version installed rather than the specific version else
    this will happen on a continuing basis.
    jackfranklin authored Jun 30, 2020
    Copy the full SHA
    9d79cc8 View commit details
  2. docs(api): fix overview diagram for pptr.dev (#6128)

    We need to serve the image from user-images.githubusercontent.com for it to work properly on pptr.dev. This broke when merging #5947.
    
    Fixes #6127.
    mathiasbynens authored Jun 30, 2020
    Copy the full SHA
    8026ca9 View commit details
  3. Copy the full SHA
    9f19862 View commit details

Commits on Jul 1, 2020

  1. chore: update Windows skipped tests. (#6133)

    The headful one I'm permanently skipping as I don't know what the issue is and I can't debug without getting my hands on a Windows machine. If anyone has one or is able to help, that'd be great!
    
    The other I'm deferring another month and will ping the FF folks :)
    jackfranklin authored Jul 1, 2020
    Copy the full SHA
    3c0dc45 View commit details
  2. feat(types): add (and fix) evaluateHandle types (#6130)

    This change started as a small change to pull types from DefinitelyTyped over to
    Puppeteer for the `evaluateHandle` function but instead ended up also fixing
    what looks to be a long standing issue with our existing documentation.
    
    `evaluateHandle` can in fact return an `ElementHandle` rather than a `JSHandle`.
    Note that `ElementHandle` extends `JSHandle` so whilst the docs are technically
    correct (all ElementHandles are JSHandles) it's confusing because JSHandles
    don't have methods like `click` on them, but ElementHandles do.
    
    if you return something that is an HTML element:
    
    ```
    const button = page.evaluateHandle(() => document.querySelector('button'));
    // this is an ElementHandle, not a JSHandle
    ```
    
    Therefore I've updated the original docs and added a large explanation to the
    TSDoc for `page.evaluateHandle`.
    
    In TypeScript land we'll assume the function will return a `JSHandle` but you
    can tell TS otherwise via the generic argument, which can only be `JSHandle`
    (the default) or `ElementHandle`:
    
    ```
    const button = page.evaluateHandle<ElementHandle>(() => document.querySelector('button'));
    ```
    jackfranklin authored Jul 1, 2020
    2
    Copy the full SHA
    8370ec8 View commit details

Commits on Jul 2, 2020

  1. feat(types): add types for $eval (#6135)

    This pulls in the types (based on the DefinitelyTyped repo) for
    `page.$eval` (and the `$eval` method on other classes). The `$eval`
    method is quite hard to type due to the way we wrap and unwrap
    ElementHandles that are passed to / returned from the `pageFunction`
    that users provide.
    
    Longer term we can improve the types by providing type overloads as
    DefinitelyTyped does but I've deferred that for now (see the `TODO` in
    the code for more details).
    jackfranklin authored Jul 2, 2020
    Copy the full SHA
    6474edb View commit details
  2. chore: add typecheck command (#6140)

    If you want to run TypeScript only to verify that it's typechecking correctly, this command is quicker as it doesn't output CJS and ESM to disk. Useful for checking during development.
    jackfranklin authored Jul 2, 2020
    Copy the full SHA
    221d172 View commit details
  3. chore(docs): reduce warnings when generating docs (#6138)

    * chore(docs): reduce warnings when generating docs
    
    This is a bunch of small miscellaneous fixes that reduce the amount of
    warnings logged when generating our new docs. The long term goal is to
    get this list down to 0 warnings, but I'll do it in multiple PRs.
    
    * satisfy doclint
    jackfranklin authored Jul 2, 2020
    Copy the full SHA
    29f7e16 View commit details
  4. Copy the full SHA
    6d06ade View commit details
Showing with 4,039 additions and 1,575 deletions.
  1. +2 −0 .eslintrc.js
  2. +1 −0 .gitignore
  3. +9 −1 .travis.yml
  4. +30 −14 README.md
  5. +4 −1 api-extractor.json
  6. +29 −0 cjs-entry-core.js
  7. +29 −0 cjs-entry.js
  8. +41 −16 docs/api.md
  9. +1 −1 docs/troubleshooting.md
  10. +48 −207 install.js
  11. +0 −1 new-docs/puppeteer.boxmodel.md
  12. +1 −1 new-docs/puppeteer.browserfetcher.download.md
  13. +1 −1 new-docs/puppeteer.browserfetcher.platform.md
  14. +1 −1 new-docs/puppeteer.browserfetcher.product.md
  15. +1 −1 new-docs/puppeteer.browserfetcher.revisioninfo.md
  16. +2 −1 new-docs/puppeteer.browserfetcheroptions.md
  17. +11 −0 new-docs/puppeteer.browserfetcherrevisioninfo.executablepath.md
  18. +11 −0 new-docs/puppeteer.browserfetcherrevisioninfo.folderpath.md
  19. +11 −0 new-docs/puppeteer.browserfetcherrevisioninfo.local.md
  20. +24 −0 new-docs/puppeteer.browserfetcherrevisioninfo.md
  21. +11 −0 new-docs/puppeteer.browserfetcherrevisioninfo.product.md
  22. +11 −0 new-docs/puppeteer.browserfetcherrevisioninfo.revision.md
  23. +11 −0 new-docs/puppeteer.browserfetcherrevisioninfo.url.md
  24. +11 −0 new-docs/puppeteer.browseroptions.defaultviewport.md
  25. +11 −0 new-docs/puppeteer.browseroptions.ignorehttpserrors.md
  26. +22 −0 new-docs/puppeteer.browseroptions.md
  27. +11 −0 new-docs/puppeteer.browseroptions.slowmo.md
  28. +11 −0 new-docs/puppeteer.chromeargoptions.args.md
  29. +11 −0 new-docs/puppeteer.chromeargoptions.devtools.md
  30. +11 −0 new-docs/puppeteer.chromeargoptions.headless.md
  31. +23 −0 new-docs/puppeteer.chromeargoptions.md
  32. +11 −0 new-docs/puppeteer.chromeargoptions.userdatadir.md
  33. +0 −11 new-docs/puppeteer.coverage._jscoverage.md
  34. +35 −7 new-docs/puppeteer.coverage.md
  35. +4 −4 new-docs/puppeteer.coverage.startcsscoverage.md
  36. +8 −5 new-docs/puppeteer.coverage.startjscoverage.md
  37. +7 −1 new-docs/puppeteer.coverage.stopcsscoverage.md
  38. +7 −1 new-docs/puppeteer.coverage.stopjscoverage.md
  39. +22 −0 new-docs/puppeteer.coverageentry.md
  40. +16 −0 new-docs/puppeteer.coverageentry.ranges.md
  41. +13 −0 new-docs/puppeteer.coverageentry.text.md
  42. +5 −3 new-docs/{puppeteer.coverage._csscoverage.md → puppeteer.coverageentry.url.md}
  43. +20 −0 new-docs/puppeteer.csscoverageoptions.md
  44. +13 −0 new-docs/puppeteer.csscoverageoptions.resetonnavigation.md
  45. +11 −0 new-docs/puppeteer.devicesmap.md
  46. +1 −1 new-docs/puppeteer.elementhandle._.md
  47. +1 −1 new-docs/puppeteer.elementhandle.__.md
  48. +3 −3 new-docs/puppeteer.elementhandle.__eval.md
  49. +4 −4 new-docs/puppeteer.elementhandle._eval.md
  50. +2 −2 new-docs/puppeteer.elementhandle.aselement.md
  51. +6 −4 new-docs/puppeteer.elementhandle.md
  52. +12 −0 new-docs/puppeteer.evaluatefn.md
  53. +12 −0 new-docs/puppeteer.evaluatefnreturntype.md
  54. +12 −0 new-docs/puppeteer.evaluatehandlefn.md
  55. +0 −22 new-docs/puppeteer.executioncontext._adoptbackendnodeid.md
  56. +0 −22 new-docs/puppeteer.executioncontext._adoptelementhandle.md
  57. +0 −11 new-docs/puppeteer.executioncontext._client.md
  58. +0 −22 new-docs/puppeteer.executioncontext._constructor_.md
  59. +0 −11 new-docs/puppeteer.executioncontext._contextid.md
  60. +0 −11 new-docs/puppeteer.executioncontext._world.md
  61. +43 −2 new-docs/puppeteer.executioncontext.evaluate.md
  62. +43 −4 new-docs/puppeteer.executioncontext.evaluatehandle.md
  63. +6 −0 new-docs/puppeteer.executioncontext.frame.md
  64. +7 −15 new-docs/puppeteer.executioncontext.md
  65. +25 −1 new-docs/puppeteer.executioncontext.queryobjects.md
  66. +0 −21 new-docs/puppeteer.filechooser._constructor_.md
  67. +3 −1 new-docs/puppeteer.filechooser.accept.md
  68. +2 −0 new-docs/puppeteer.filechooser.cancel.md
  69. +2 −0 new-docs/puppeteer.filechooser.ismultiple.md
  70. +23 −7 new-docs/puppeteer.filechooser.md
  71. +3 −3 new-docs/puppeteer.frame.__eval.md
  72. +4 −4 new-docs/puppeteer.frame._eval.md
  73. +2 −2 new-docs/puppeteer.frame.click.md
  74. +4 −4 new-docs/puppeteer.frame.evaluatehandle.md
  75. +2 −2 new-docs/puppeteer.frame.waitfor.md
  76. +2 −2 new-docs/puppeteer.frame.waitforfunction.md
  77. +13 −0 new-docs/puppeteer.geolocationoptions.accuracy.md
  78. +13 −0 new-docs/puppeteer.geolocationoptions.latitude.md
  79. +13 −0 new-docs/puppeteer.geolocationoptions.longitude.md
  80. +21 −0 new-docs/puppeteer.geolocationoptions.md
  81. +0 −22 new-docs/puppeteer.httpresponse._constructor_.md
  82. +0 −22 new-docs/puppeteer.httpresponse._resolvebody.md
  83. +2 −0 new-docs/puppeteer.httpresponse.buffer.md
  84. +2 −0 new-docs/puppeteer.httpresponse.frame.md
  85. +2 −0 new-docs/puppeteer.httpresponse.fromcache.md
  86. +2 −0 new-docs/puppeteer.httpresponse.fromserviceworker.md
  87. +2 −0 new-docs/puppeteer.httpresponse.headers.md
  88. +6 −0 new-docs/puppeteer.httpresponse.json.md
  89. +4 −5 new-docs/puppeteer.httpresponse.md
  90. +2 −0 new-docs/puppeteer.httpresponse.ok.md
  91. +3 −1 new-docs/puppeteer.httpresponse.remoteaddress.md
  92. +2 −0 new-docs/puppeteer.httpresponse.request.md
  93. +2 −0 new-docs/puppeteer.httpresponse.securitydetails.md
  94. +2 −0 new-docs/puppeteer.httpresponse.status.md
  95. +2 −0 new-docs/puppeteer.httpresponse.statustext.md
  96. +2 −0 new-docs/puppeteer.httpresponse.text.md
  97. +2 −0 new-docs/puppeteer.httpresponse.url.md
  98. +21 −0 new-docs/puppeteer.jscoverageoptions.md
  99. +13 −0 new-docs/puppeteer.jscoverageoptions.reportanonymousscripts.md
  100. +13 −0 new-docs/puppeteer.jscoverageoptions.resetonnavigation.md
  101. +0 −11 new-docs/puppeteer.jshandle._client.md
  102. +0 −22 new-docs/puppeteer.jshandle._constructor_.md
  103. +0 −11 new-docs/puppeteer.jshandle._context.md
  104. +0 −11 new-docs/puppeteer.jshandle._disposed.md
  105. +0 −11 new-docs/puppeteer.jshandle._remoteobject.md
  106. +2 −0 new-docs/puppeteer.jshandle.aselement.md
  107. +1 −1 new-docs/puppeteer.jshandle.dispose.md
  108. +4 −4 new-docs/puppeteer.jshandle.evaluate.md
  109. +6 −6 new-docs/puppeteer.jshandle.evaluatehandle.md
  110. +2 −0 new-docs/puppeteer.jshandle.executioncontext.md
  111. +2 −0 new-docs/puppeteer.jshandle.getproperty.md
  112. +1 −1 new-docs/puppeteer.jshandle.jsonvalue.md
  113. +17 −16 new-docs/puppeteer.jshandle.md
  114. +6 −0 new-docs/puppeteer.jshandle.tostring.md
  115. +12 −0 new-docs/puppeteer.jsonarray.md
  116. +12 −0 new-docs/puppeteer.jsonobject.md
  117. +0 −11 new-docs/puppeteer.keyboard._client.md
  118. +0 −20 new-docs/puppeteer.keyboard._constructor_.md
  119. +0 −11 new-docs/puppeteer.keyboard._modifiers.md
  120. +0 −11 new-docs/puppeteer.keyboard._pressedkeys.md
  121. +12 −2 new-docs/puppeteer.keyboard.down.md
  122. +40 −15 new-docs/puppeteer.keyboard.md
  123. +10 −2 new-docs/puppeteer.keyboard.press.md
  124. +15 −1 new-docs/puppeteer.keyboard.sendcharacter.md
  125. +19 −2 new-docs/puppeteer.keyboard.type.md
  126. +3 −1 new-docs/puppeteer.keyboard.up.md
  127. +0 −11 new-docs/puppeteer.keydefinition.code.md
  128. +0 −11 new-docs/puppeteer.keydefinition.key.md
  129. +0 −11 new-docs/puppeteer.keydefinition.keycode.md
  130. +0 −11 new-docs/puppeteer.keydefinition.location.md
  131. +0 −33 new-docs/puppeteer.keydefinition.md
  132. +0 −11 new-docs/puppeteer.keydefinition.shiftkey.md
  133. +0 −11 new-docs/puppeteer.keydefinition.shiftkeycode.md
  134. +0 −11 new-docs/puppeteer.keydefinition.shifttext.md
  135. +0 −11 new-docs/puppeteer.keydefinition.text.md
  136. +0 −11 new-docs/puppeteer.keydefinitions.md
  137. +2 −0 new-docs/puppeteer.keyinput.md
  138. +11 −0 new-docs/puppeteer.launchoptions.dumpio.md
  139. +11 −0 new-docs/puppeteer.launchoptions.env.md
  140. +11 −0 new-docs/puppeteer.launchoptions.executablepath.md
  141. +11 −0 new-docs/puppeteer.launchoptions.handlesighup.md
  142. +11 −0 new-docs/puppeteer.launchoptions.handlesigint.md
  143. +11 −0 new-docs/puppeteer.launchoptions.handlesigterm.md
  144. +11 −0 new-docs/puppeteer.launchoptions.ignoredefaultargs.md
  145. +28 −0 new-docs/puppeteer.launchoptions.md
  146. +11 −0 new-docs/puppeteer.launchoptions.pipe.md
  147. +11 −0 new-docs/puppeteer.launchoptions.timeout.md
  148. +39 −14 new-docs/puppeteer.md
  149. +1 −0 new-docs/puppeteer.metrics.md
  150. +0 −11 new-docs/puppeteer.mouse._button.md
  151. +0 −11 new-docs/puppeteer.mouse._client.md
  152. +0 −21 new-docs/puppeteer.mouse._constructor_.md
  153. +0 −11 new-docs/puppeteer.mouse._keyboard.md
  154. +0 −11 new-docs/puppeteer.mouse._x.md
  155. +0 −11 new-docs/puppeteer.mouse._y.md
  156. +5 −3 new-docs/puppeteer.mouse.click.md
  157. +3 −1 new-docs/puppeteer.mouse.down.md
  158. +63 −16 new-docs/puppeteer.mouse.md
  159. +5 −3 new-docs/puppeteer.mouse.move.md
  160. +3 −1 new-docs/puppeteer.mouse.up.md
  161. +4 −3 new-docs/{puppeteer.mousebuttoninput.md → puppeteer.mousebutton.md}
  162. +11 −0 new-docs/puppeteer.mouseoptions.button.md
  163. +11 −0 new-docs/puppeteer.mouseoptions.clickcount.md
  164. +20 −0 new-docs/puppeteer.mouseoptions.md
  165. +7 −1 new-docs/puppeteer.page._.md
  166. +3 −3 new-docs/puppeteer.page.__eval.md
  167. +49 −5 new-docs/puppeteer.page._eval.md
  168. +2 −0 new-docs/puppeteer.page.browser.md
  169. +2 −0 new-docs/puppeteer.page.browsercontext.md
  170. +2 −2 new-docs/puppeteer.page.click.md
  171. +49 −4 new-docs/puppeteer.page.evaluatehandle.md
  172. +2 −0 new-docs/puppeteer.page.frames.md
  173. +1 −1 new-docs/puppeteer.page.goback.md
  174. +1 −1 new-docs/puppeteer.page.goforward.md
  175. +1 −1 new-docs/puppeteer.page.goto.md
  176. +2 −0 new-docs/puppeteer.page.isjavascriptenabled.md
  177. +2 −0 new-docs/puppeteer.page.mainframe.md
  178. +3 −3 new-docs/puppeteer.page.md
  179. +1 −1 new-docs/puppeteer.page.reload.md
  180. +1 −1 new-docs/puppeteer.page.setcontent.md
  181. +1 −1 new-docs/puppeteer.page.setdefaultnavigationtimeout.md
  182. +1 −1 new-docs/puppeteer.page.setdefaulttimeout.md
  183. +16 −6 new-docs/puppeteer.page.setgeolocation.md
  184. +1 −1 new-docs/puppeteer.page.setofflinemode.md
  185. +32 −1 new-docs/puppeteer.page.setrequestinterception.md
  186. +2 −0 new-docs/puppeteer.page.target.md
  187. +2 −2 new-docs/puppeteer.page.waitfor.md
  188. +4 −4 new-docs/puppeteer.page.waitforfilechooser.md
  189. +2 −2 new-docs/puppeteer.page.waitforfunction.md
  190. +1 −1 new-docs/puppeteer.page.waitfornavigation.md
  191. +2 −0 new-docs/puppeteer.page.workers.md
  192. +13 −0 new-docs/puppeteer.platform.md
  193. +13 −0 new-docs/puppeteer.product.md
  194. +22 −0 new-docs/puppeteer.productlauncher.connect.md
  195. +22 −0 new-docs/puppeteer.productlauncher.defaultargs.md
  196. +11 −0 new-docs/puppeteer.productlauncher.executablepath.md
  197. +22 −0 new-docs/puppeteer.productlauncher.launch.md
  198. +29 −0 new-docs/puppeteer.productlauncher.md
  199. +11 −0 new-docs/puppeteer.productlauncher.product.md
  200. +0 −15 new-docs/puppeteer.puppeteer.__experimental_clearqueryhandlers.md
  201. +0 −15 new-docs/puppeteer.puppeteer.__experimental_customqueryhandlers.md
  202. +0 −23 new-docs/puppeteer.puppeteer.__experimental_registercustomqueryhandler.md
  203. +0 −22 new-docs/puppeteer.puppeteer.__experimental_unregistercustomqueryhandler.md
  204. +0 −23 new-docs/puppeteer.puppeteer._constructor_.md
  205. +0 −11 new-docs/puppeteer.puppeteer._launcher.md
  206. +0 −13 new-docs/puppeteer.puppeteer._productname.md
  207. +0 −11 new-docs/puppeteer.puppeteer._projectroot.md
  208. +8 −1 new-docs/puppeteer.puppeteer.connect.md
  209. +3 −1 new-docs/puppeteer.puppeteer.createbrowserfetcher.md
  210. +3 −1 new-docs/puppeteer.puppeteer.defaultargs.md
  211. +22 −0 new-docs/puppeteer.puppeteer.devices.md
  212. +22 −0 new-docs/puppeteer.puppeteer.errors.md
  213. +6 −0 new-docs/puppeteer.puppeteer.executablepath.md
  214. +20 −1 new-docs/puppeteer.puppeteer.launch.md
  215. +24 −16 new-docs/puppeteer.puppeteer.md
  216. +5 −0 new-docs/puppeteer.puppeteer.product.md
  217. +11 −0 new-docs/puppeteer.remoteaddress.ip.md
  218. +20 −0 new-docs/puppeteer.remoteaddress.md
  219. +11 −0 new-docs/puppeteer.remoteaddress.port.md
  220. +12 −0 new-docs/puppeteer.serializable.md
  221. +12 −0 new-docs/puppeteer.serializableorjshandle.md
  222. +0 −11 new-docs/puppeteer.touchscreen._client.md
  223. +0 −21 new-docs/puppeteer.touchscreen._constructor_.md
  224. +0 −11 new-docs/puppeteer.touchscreen._keyboard.md
  225. +5 −12 new-docs/puppeteer.touchscreen.md
  226. +4 −2 new-docs/puppeteer.touchscreen.tap.md
  227. +0 −20 new-docs/puppeteer.tracing._constructor_.md
  228. +18 −6 new-docs/puppeteer.tracing.md
  229. +7 −1 new-docs/puppeteer.tracing.start.md
  230. +4 −0 new-docs/puppeteer.tracing.stop.md
  231. +11 −0 new-docs/puppeteer.tracingoptions.categories.md
  232. +21 −0 new-docs/puppeteer.tracingoptions.md
  233. +11 −0 new-docs/puppeteer.tracingoptions.path.md
  234. +11 −0 new-docs/puppeteer.tracingoptions.screenshots.md
  235. +13 −0 new-docs/puppeteer.unwrapelementhandle.md
  236. +20 −0 new-docs/puppeteer.waitforoptions.md
  237. +18 −0 new-docs/puppeteer.waitforoptions.timeout.md
  238. +11 −0 new-docs/puppeteer.waitforoptions.waituntil.md
  239. +19 −0 new-docs/puppeteer.waittimeoutoptions.md
  240. +18 −0 new-docs/puppeteer.waittimeoutoptions.timeout.md
  241. +3 −3 new-docs/puppeteer.webworker.evaluatehandle.md
  242. +13 −0 new-docs/puppeteer.wrapelementhandle.md
  243. +10 −9 package.json
  244. +21 −2 scripts/test-install.sh
  245. +4 −0 src/api-docs-entry.ts
  246. +114 −12 src/common/Coverage.ts
  247. +65 −25 src/common/DOMWorld.ts
  248. +2 −2 src/common/Debug.ts
  249. +75 −0 src/common/EvalTypes.ts
  250. +156 −7 src/common/ExecutionContext.ts
  251. +31 −0 src/common/FileChooser.ts
  252. +24 −15 src/common/FrameManager.ts
  253. +71 −1 src/common/HTTPResponse.ts
  254. +237 −19 src/common/Input.ts
  255. +187 −111 src/common/JSHandle.ts
  256. +290 −24 src/common/Page.ts
  257. +151 −13 src/common/Puppeteer.ts
  258. +3 −0 src/common/Target.ts
  259. +32 −1 src/common/Tracing.ts
  260. +12 −0 src/common/USKeyboardLayout.ts
  261. +14 −6 src/common/WebWorker.ts
  262. +0 −1 src/common/helper.ts
  263. +17 −0 src/environment.ts
  264. +20 −0 src/index-core.ts
  265. +2 −16 src/index.ts
  266. +8 −17 src/initialize.ts
  267. +176 −0 src/install.ts
  268. +17 −8 src/node/BrowserFetcher.ts
  269. +2 −1 src/node/BrowserRunner.ts
  270. +13 −0 src/node/LaunchOptions.ts
  271. +18 −6 src/node/Launcher.ts
  272. +25 −0 src/revisions.ts
  273. +1 −1 test/click.spec.ts
  274. +2 −8 test/elementhandle.spec.ts
  275. +3 −8 test/headful.spec.ts
  276. +20 −12 test/input.spec.ts
  277. +1 −12 test/jshandle.spec.ts
  278. +12 −6 test/keyboard.spec.ts
  279. +6 −6 test/launcher.spec.ts
  280. +7 −0 test/mocha-utils.ts
  281. +3 −3 test/page.spec.ts
  282. +10 −4 test/queryselector.spec.ts
  283. +2 −2 test/requestinterception.spec.ts
  284. +7 −0 tsconfig-esm.json
  285. +1 −1 tsconfig.json
  286. +4 −3 utils/check_availability.js
  287. +39 −0 utils/doclint/check_public_api/index.js
  288. +3 −2 utils/doclint/cli.js
  289. +1 −0 utils/prepare_puppeteer_core.js
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -96,6 +96,8 @@ module.exports = {
"rules": {
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": 2,
"func-call-spacing": 0,
"@typescript-eslint/func-call-spacing": 2,
"semi": 0,
"@typescript-eslint/semi": 2,
"@typescript-eslint/no-empty-function": 0,
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -17,3 +17,4 @@ yarn.lock
test/coverage.json
temp/
dependency-chart.png
puppeteer-core-*.tgz
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -64,11 +64,19 @@ jobs:
- CHROMIUM=true
script:
- npm run compare-protocol-d-ts
- npm run test-install
- npm run lint
- npm run test-doclint
- npm run ensure-new-docs-up-to-date

# This bot runs separately as it changes package.json to test puppeteer-core
# and we don't want that leaking into other bots and causing issues.
- node_js: "10.19.0"
name: 'Test bundling and install of packages'
env:
- CHROMIUM=true
script:
- npm run test-install

# Runs unit tests on Linux + Firefox
- node_js: "10.19.0"
name: 'Unit tests: Linux/Firefox'
44 changes: 30 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@

<img src="https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png" height="200" align="right">

###### [API](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md)
###### [API](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md)

> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.
@@ -37,7 +37,7 @@ npm i puppeteer
# or "yarn add puppeteer"
```

Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md#environment-variables).
Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md#environment-variables).


### puppeteer-core
@@ -63,7 +63,7 @@ Note: Prior to v1.18.1, Puppeteer required at least Node v6.4.0. Versions from v
Node 8.9.0+. Starting from v3.0.0 Puppeteer starts to rely on Node 10.18.1+. All examples below use async/await which is only supported in Node v7.6.0 or greater.

Puppeteer will be familiar to people using other browser testing frameworks. You create an instance
of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md#).
of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md#).

**Example** - navigating to https://example.com and saving a screenshot as *example.png*:

@@ -88,7 +88,7 @@ Execute script on the command line
node example.js
```

Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md#pagesetviewportviewport).
Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md#pagesetviewportviewport).

**Example** - create a PDF.

@@ -113,7 +113,7 @@ Execute script on the command line
node hn.js
```

See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.
See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.

**Example** - evaluate script in the context of the page

@@ -148,7 +148,7 @@ Execute script on the command line
node get-dimensions.js
```

See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.
See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.

<!-- [END getstarted] -->

@@ -157,7 +157,7 @@ See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/

**1. Uses Headless mode**

Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:
Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:

```js
const browser = await puppeteer.launch({headless: false}); // default is true
@@ -173,7 +173,7 @@ pass in the executable's path when creating a `Browser` instance:
const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});
```

You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md#puppeteerlaunchoptions) for more information.
You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md#puppeteerlaunchoptions) for more information.

See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.

@@ -185,7 +185,7 @@ Puppeteer creates its own browser user profile which it **cleans up on every run

## Resources

- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md)
- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md)
- [Examples](https://github.com/puppeteer/puppeteer/tree/main/examples/)
- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)

@@ -292,9 +292,25 @@ Puppeteer creates its own browser user profile which it **cleans up on every run

- debug your test inside chromium like a boss!


<!-- [END debugging] -->


<!-- [START typescript] -->
## Usage with TypeScript

We have recently completed a migration to move the Puppeteer source code from JavaScript to TypeScript and we're currently working on shipping type definitions for TypeScript with Puppeteer's npm package.

Until this work is complete we recommend installing the Puppeteer type definitions from the [DefinitelyTyped](https://definitelytyped.org/) repository:

```bash
npm install --save-dev @types/puppeteer
```

The types that you'll see appearing in the Puppeteer source code are based off the great work of those who have contributed to the `@types/puppeteer` package. We really appreciate the hard work those people put in to providing high quality TypeScript definitions for Puppeteer's users.

<!-- [END typescript] -->


## Contributing to Puppeteer

Check out [contributing guide](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) to get an overview of Puppeteer development.
@@ -312,7 +328,7 @@ See [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING
Official Firefox support is currently experimental. The ongoing collaboration with Mozilla aims to support common end-to-end testing use cases, for which developers expect cross-browser coverage. The Puppeteer team needs input from users to stabilize Firefox support and to bring missing APIs to our attention.
From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox.
From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox.
We will continue to collaborate with other browser vendors to bring Puppeteer support to browsers such as Safari.
This effort includes exploration of a standard for executing cross-browser commands (instead of relying on the non-standard DevTools Protocol used by Chrome).
@@ -364,12 +380,12 @@ npm install puppeteer-core@chrome-71
#### Q: Which Chromium version does Puppeteer use?
Look for `chromium_revision` in [package.json](https://github.com/puppeteer/puppeteer/blob/main/package.json). To find the corresponding Chromium commit and version number, search for the revision prefixed by an `r` in [OmahaProxy](https://omahaproxy.appspot.com/)'s "Find Releases" section.
Look for the `chromium` entry in [revisions.ts](https://github.com/puppeteer/puppeteer/blob/main/src/revisions.ts). To find the corresponding Chromium commit and version number, search for the revision prefixed by an `r` in [OmahaProxy](https://omahaproxy.appspot.com/)'s "Find Releases" section.


#### Q: Which Firefox version does Puppeteer use?

Since Firefox support is experimental, Puppeteer downloads the latest [Firefox Nightly](https://wiki.mozilla.org/Nightly) when the `PUPPETEER_PRODUCT` environment variable is set to `firefox`. That's also why the value of `firefox_revision` in [package.json](https://github.com/puppeteer/puppeteer/blob/main/package.json) is `latest` -- Puppeteer isn't tied to a particular Firefox version.
Since Firefox support is experimental, Puppeteer downloads the latest [Firefox Nightly](https://wiki.mozilla.org/Nightly) when the `PUPPETEER_PRODUCT` environment variable is set to `firefox`. That's also why the value of `firefox` in [revisions.ts](https://github.com/puppeteer/puppeteer/blob/main/src/revisions.ts) is `latest` -- Puppeteer isn't tied to a particular Firefox version.

To fetch Firefox Nightly as part of Puppeteer installation:

@@ -408,7 +424,7 @@ await page.evaluate(() => {
You may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/puppeteer/puppeteer/issues/291).) There are two reasons for this:
* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v4.0.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)
* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.0.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)
* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).
#### Q: I am having trouble installing / running Puppeteer in my test environment. Where should I look for help?
5 changes: 4 additions & 1 deletion api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "<projectFolder>/lib/api-docs-entry.d.ts",
"mainEntryPointFilePath": "<projectFolder>/lib/cjs/api-docs-entry.d.ts",
"bundledPackages": [ ],

"apiReport": {
@@ -27,6 +27,9 @@
},

"extractorMessageReporting": {
"ae-internal-missing-underscore": {
"logLevel": "none"
},
"default": {
"logLevel": "warning"
}
29 changes: 29 additions & 0 deletions cjs-entry-core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2020 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* We use `export default puppeteer` in `src/index.ts` to expose the library But
* TypeScript in CJS mode compiles that to `exports.default = `. This means that
* our CJS Node users would have to use `require('puppeteer').default` which
* isn't very nice.
*
* So instead we expose this file as our entry point. This requires the compiled
* Puppeteer output and re-exports the `default` export via `module.exports.`
* This means that we can publish to CJS and ESM whilst maintaining the expected
* import behaviour for CJS and ESM users.
*/
const puppeteerExport = require('./lib/cjs/index-core');
module.exports = puppeteerExport.default;
29 changes: 29 additions & 0 deletions cjs-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2020 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* We use `export default puppeteer` in `src/index.ts` to expose the library But
* TypeScript in CJS mode compiles that to `exports.default = `. This means that
* our CJS Node users would have to use `require('puppeteer').default` which
* isn't very nice.
*
* So instead we expose this file as our entry point. This requires the compiled
* Puppeteer output and re-exports the `default` export via `module.exports.`
* This means that we can publish to CJS and ESM whilst maintaining the expected
* import behaviour for CJS and ESM users.
*/
const puppeteerExport = require('./lib/cjs/index');
module.exports = puppeteerExport.default;
Loading