Skip to content

Commit aa1ce45

Browse files
committed
Update README and show changelog in the document
1 parent a824839 commit aa1ce45

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

README.md

+38-4
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,33 @@ Install by pip from PyPI:
2929
python3 -m pip install pyppeteer
3030
```
3131

32-
Or install latest version from github:
32+
Or install latest version from [github](https://github.com/miyakogi/pyppeteer):
3333

3434
```
3535
python3 -m pip install -U git+https://github.com/miyakogi/pyppeteer.git@dev
3636
```
3737

3838
## Usage
3939

40-
Below code open web page and take a screenshot.
40+
> **Note**: When you run pyppeteer first time, it downloads a recent version of Chromium (~100MB).
41+
42+
**Example**: open web page and take a screenshot.
43+
44+
```py
45+
import asyncio
46+
from pyppeteer.launcher import launch
47+
48+
async def main(browser):
49+
page = await browser.newPage()
50+
await page.goto('http://example.com')
51+
await page.screenshot({'path': 'example.png'})
52+
53+
browser = launch()
54+
asyncio.get_event_loop().run_until_complete(main(browser))
55+
browser.close()
56+
```
57+
58+
**Example**: evaluate script on the page.
4159

4260
```py
4361
import asyncio
@@ -48,6 +66,17 @@ async def main(browser):
4866
await page.goto('http://example.com')
4967
await page.screenshot({'path': 'example.png'})
5068

69+
dimensions = await page.evaluate('''() => {
70+
return {
71+
width: document.documentElement.clientWidth,
72+
height: document.documentElement.clientHeight,
73+
deviceScaleFactor: window.devicePixelRatio,
74+
}
75+
}''')
76+
77+
print(dimensions)
78+
# >>> {'width': 800, 'height': 600, 'deviceScaleFactor': 1}
79+
5180
browser = launch()
5281
asyncio.get_event_loop().run_until_complete(main(browser))
5382
browser.close()
@@ -103,7 +132,12 @@ element = await page.querySelector('h1')
103132
title = await element.evaluate('(element) => element.textContent')
104133
```
105134

106-
Credits
107-
---------
135+
## Future Plan
136+
137+
1. Catch up development of puppeteer
138+
* Not intend to add original API which puppeteer does not have
139+
2. Add more tests and fix bugs
140+
141+
## Credits
108142

109143
This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.

docs/changes.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. mdinclude:: ../CHANGES.md

docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Contents
1313
installation
1414
usage
1515
reference
16+
changes
1617

1718
Indices and tables
1819
==================

0 commit comments

Comments
 (0)