{"id":13493575,"url":"https://github.com/pyppeteer/pyppeteer","last_synced_at":"2026-01-16T02:20:54.149Z","repository":{"id":37400788,"uuid":"237223760","full_name":"pyppeteer/pyppeteer","owner":"pyppeteer","description":"Headless chrome/chromium automation library (unofficial port of puppeteer)","archived":false,"fork":false,"pushed_at":"2024-06-29T14:49:45.000Z","size":6224,"stargazers_count":3834,"open_issues_count":214,"forks_count":335,"subscribers_count":46,"default_branch":"dev","last_synced_at":"2025-04-22T23:15:29.545Z","etag":null,"topics":["automation","chromium","puppeteer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyppeteer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-30T13:54:40.000Z","updated_at":"2025-04-21T15:37:01.000Z","dependencies_parsed_at":"2024-01-03T00:18:22.367Z","dependency_job_id":"c285d722-9044-403e-b2d0-78dff2cf3546","html_url":"https://github.com/pyppeteer/pyppeteer","commit_stats":{"total_commits":801,"total_committers":56,"mean_commits":"14.303571428571429","dds":"0.22846441947565543","last_synced_commit":"7dc91ee5173d3836f77800a3774beeaf2b448c0e"},"previous_names":["pyppeteer/pyppeteer2"],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyppeteer%2Fpyppeteer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyppeteer%2Fpyppeteer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyppeteer%2Fpyppeteer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyppeteer%2Fpyppeteer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyppeteer","download_url":"https://codeload.github.com/pyppeteer/pyppeteer/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337950,"owners_count":21414104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","chromium","puppeteer"],"created_at":"2024-07-31T19:01:16.735Z","updated_at":"2026-01-16T02:20:54.103Z","avatar_url":"https://github.com/pyppeteer.png","language":"Python","funding_links":[],"categories":["Python","Related","Chrome DevTools Protocol"],"sub_categories":["Libraries for driving the protocol (or a layer above)"],"readme":"### Attention: This repo is unmaintained and has been outside of minor changes for a long time. Please consider [playwright-python](https://github.com/microsoft/playwright-python) as an alternative. \nIf you are interested in maintaining this, please contact [me](https://github.com/Mattwmaster58)\n\npyppeteer\n==========\n\n[![PyPI](https://img.shields.io/pypi/v/pyppeteer.svg)](https://pypi.python.org/pypi/pyppeteer)\n[![PyPI version](https://img.shields.io/pypi/pyversions/pyppeteer.svg)](https://pypi.python.org/pypi/pyppeteer)\n[![Documentation](https://img.shields.io/badge/docs-latest-brightgreen.svg)](https://pyppeteer.github.io/pyppeteer/)\n[![CircleCI](https://circleci.com/gh/pyppeteer/pyppeteer.svg?style=shield)](https://circleci.com/gh/pyppeteer/pyppeteer)\n[![codecov](https://codecov.io/gh/pyppeteer/pyppeteer/branch/dev/graph/badge.svg)](https://codecov.io/gh/pyppeteer/pyppeteer)\n\n_Note: this is a continuation of the [pyppeteer project](https://github.com/miyakogi/pyppeteer)_\n\nUnofficial Python port of [puppeteer](https://github.com/GoogleChrome/puppeteer) JavaScript (headless) chrome/chromium browser automation library.\n\n* Free software: MIT license (including the work distributed under the Apache 2.0 license)\n* Documentation: https://pyppeteer.github.io/pyppeteer/\n\n## Installation\n\npyppeteer requires Python \u003e= 3.8\n\nInstall with `pip` from PyPI:\n\n```\npip install pyppeteer\n```\n\nOr install the latest version from [this github repo](https://github.com/pyppeteer/pyppeteer/):\n\n```\npip install -U git+https://github.com/pyppeteer/pyppeteer@dev\n```\n\n## Usage\n\n\u003e **Note**: When you run pyppeteer for the first time, it downloads the latest version of Chromium (~150MB) if it is not found on your system. If you don't prefer this behavior, ensure that a suitable Chrome binary is installed. One way to do this is to run `pyppeteer-install` command before prior to using this library.\n\nFull documentation can be found [here](https://pyppeteer.github.io/pyppeteer/reference.html). [Puppeteer's documentation](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#) and [its troubleshooting guide](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) are also great resources for pyppeteer users.\n\n### Examples\n\nOpen web page and take a screenshot:\n```py\nimport asyncio\nfrom pyppeteer import launch\n\nasync def main():\n    browser = await launch()\n    page = await browser.newPage()\n    await page.goto('https://example.com')\n    await page.screenshot({'path': 'example.png'})\n    await browser.close()\n\nasyncio.get_event_loop().run_until_complete(main())\n```\n\nEvaluate javascript on a page:\n```py\nimport asyncio\nfrom pyppeteer import launch\n\nasync def main():\n    browser = await launch()\n    page = await browser.newPage()\n    await page.goto('https://example.com')\n    await page.screenshot({'path': 'example.png'})\n\n    dimensions = await page.evaluate('''() =\u003e {\n        return {\n            width: document.documentElement.clientWidth,\n            height: document.documentElement.clientHeight,\n            deviceScaleFactor: window.devicePixelRatio,\n        }\n    }''')\n\n    print(dimensions)\n    # \u003e\u003e\u003e {'width': 800, 'height': 600, 'deviceScaleFactor': 1}\n    await browser.close()\n\nasyncio.get_event_loop().run_until_complete(main())\n```\n\n## Differences between puppeteer and pyppeteer\n\npyppeteer strives to replicate the puppeteer API as close as possible, however, fundamental differences between Javascript and Python make this difficult to do precisely. More information on specifics can be found in the [documentation](https://pyppeteer.github.io/pyppeteer/reference.html).\n\n### Keyword arguments for options\n\npuppeteer uses an object for passing options to functions/methods. pyppeteer methods/functions accept both dictionary (python equivalent to JavaScript's objects) and keyword arguments for options.\n\nDictionary style options (similar to puppeteer):\n\n```python\nbrowser = await launch({'headless': True})\n```\n\nKeyword argument style options (more pythonic, isn't it?):\n\n```python\nbrowser = await launch(headless=True)\n```\n\n### Element selector method names\n\nIn python, `$` is not a valid identifier. The equivalent methods to Puppeteer's `$`, `$$`, and `$x` methods are listed below, along with some shorthand methods for your convenience:\n\n| puppeteer | pyppeteer              | pyppeteer shorthand |\n|-----------|-------------------------|----------------------|\n| Page.$()  | Page.querySelector()    | Page.J()             |\n| Page.$$() | Page.querySelectorAll() | Page.JJ()            |\n| Page.$x() | Page.xpath()            | Page.Jx()            |\n\n### Arguments of `Page.evaluate()` and `Page.querySelectorEval()`\n\npuppeteer's version of `evaluate()` takes a JavaScript function or a string representation of a JavaScript expression. pyppeteer takes string representation of JavaScript expression or function. pyppeteer will try to automatically detect if the string is function or expression, but it will fail sometimes. If an expression is erroneously treated as function and an error is raised, try setting `force_expr` to `True`, to force pyppeteer to treat the string as expression.\n\n### Examples:\n\nGet a page's `textContent`:\n\n```python\ncontent = await page.evaluate('document.body.textContent', force_expr=True)\n```\n\nGet an element's `textContent`:\n\n```python\nelement = await page.querySelector('h1')\ntitle = await page.evaluate('(element) =\u003e element.textContent', element)\n```\n\n## Roadmap\n\nSee [projects](https://github.com/pyppeteer/pyppeteer/projects)\n\n## Credits\n\n###### This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyppeteer%2Fpyppeteer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyppeteer%2Fpyppeteer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyppeteer%2Fpyppeteer/lists"}