Commit Graph

956 Commits

Author SHA1 Message Date
Andrey Lushnikov
ce8a952044 refactor: migrate NavigatorWatcher to lifecycle events (#1141)
This patch:
- migrates navigation watcher to use protocol-issued lifecycle events.
- removes `networkIdleTimeout` and `networkIdleInflight` options for
  `page.goto` method
- adds a new `networkidle0` value to the waitUntil option of navigation
  methods

References #728.

BREAKING CHANGE:

As an implication of this new approach, the `networkIdleTimeout` and
`networkIdleInflight` options are no longer supported. Interested
clients should implement the behavior themselves using the `request` and
`response` events.
2017-10-23 18:10:59 -07:00
JoelEinbinder
126ab7b90e feat(keyboard): Accept codes (#1116)
BREAKING CHANGE:

This patch lets key names be code in addition to key. When specifying a code, the proper text is generated assuming a standard US keyboard layout. e.g Digit5 -> "5" or "%" depending on Shift.

* location is now specified. #777

* Using unknown key names now throws an error. #723

* Typing newlines now correctly presses enter. #681
2017-10-23 12:43:45 -07:00
r3dDoX
945a826a0b feat(install): add environment variable to overwrite host part of url (#958)
This patch adds PUPPETEER_DOWNLOAD_HOST env variable that allows to specify a download host. Useful for downloading from mirrors.

Fixes #951
2017-10-21 18:22:13 -07:00
Neeraj Singh
c9e1a2de4e docs(api): document that JSHandle.jsonValue might return error/blank (#1118) 2017-10-21 01:33:43 -07:00
JoelEinbinder
9603bab0c7 chore(yarn): update yarn lock #1113 2017-10-20 17:03:13 -07:00
Andrey Lushnikov
bcc969ccc4 feat(interception): Implement request.mockResponse method (#1064)
feat(interception): Implement request.respond method

This patch implements a new Request.respond method. This
allows users to fulfill the intercepted request with a hand-crafted
response if they wish so.

References #1020.
2017-10-20 16:55:15 -07:00
Andrey Lushnikov
7f60e33a63 feat(Chromium): roll Chromium to r510398 (#1112)
This roll includes revision https://crrev.com/510285 that fixes
the clipping bug on retina displays.

Fixes #733
2017-10-20 10:58:39 -07:00
Andrey Lushnikov
5c92ba222a fix(page.evaluate): jsonValue should ignore toJSON property (#1098)
Currently, JSHandle.jsonValue() is implemented as in-page JSON.stringify
call and consequent JSON.parse in node. This approach proved to be
unfortunate for automation purposes: if page author overrode the
Object.prototype.toJSON method, then it's harder for puppeteer to
interact with the page.

This patch switches JSHandle.jsonValue to use protocol serialization
that ignores toJSON property. THis also changes the `page.evaluate`
behavior since it is based on JSHandle.jsonValue().

Fixes #1003.

BREAKING CHANGE:
`page.evaluate` no longer calls toJSON when generating return value.
For the old behavior, do JSON.parse/JSON.stringify manually:

```js
const json = JSON.parse(await page.evaluate(() => JSON.stringify(obj)));
```
2017-10-20 10:45:49 -07:00
Andrey Lushnikov
0f64f3e984 test: add test to make sure clipping is correct on retina displays (#1111)
The test is currently disabled since it doesn't work.

References #733
2017-10-20 10:45:22 -07:00
Andrey Lushnikov
ace239cb01 feat(Chromium): roll Chromium to r510141 (#1101)
This roll includes the following important revisions:
- https://crrev.com/509990 - DevTools: Allow location to be specified in
  Input.dispatchKeyEvent
- https://crrev.com/509486 - DevTools: fix extra HTTP headers not sent
on browser navigation request

References #877, references #777
2017-10-19 17:15:10 -07:00
Andrey Lushnikov
4f64dfd993 feat(Request): allow aborting intercepted requests with custom reasons (#1080)
This patch adds optional parameter to the `request.abort()` method
that specifies abort reason.

References #1020.
2017-10-18 00:26:48 -07:00
JoelEinbinder
7fbd2cb661 chore(typescript): switch to 2.6-rc (#1078) 2017-10-17 23:33:21 -07:00
JoelEinbinder
f67ae5711d test(cookies): enable cookies restoration test (#1075) 2017-10-17 23:32:33 -07:00
Sashiyama Yoshiki
eee168a745 chore(downloader): fix typo in error exception message (#1076) 2017-10-17 21:33:16 -07:00
Christian Davis
b3857bd690 fix(page): page.close() assert that connection is not closed (#1038) 2017-10-17 19:24:34 -07:00
JoelEinbinder
e943efe1e3 feat(chromium): roll chromium to r509368 (#1063) 2017-10-17 19:19:49 -07:00
JoelEinbinder
32398d11bd feat(Browser): introduce Browser.pages() (#554)
This patch:
- introduces Target class that represents any inspectable target, such as service worker or page
- emits events when targets come and go
- introduces target.page() to instantiate a page from a target

Fixes #386, fixes #443.
2017-10-17 19:14:57 -07:00
Andrey Lushnikov
273c733237 feat(Request): introduce Request.failure() method (#1065)
Similarly to the `request.response()` method, this patch adds
`request.failure()` method that returns error details for the failed
requests.

Fixes #901.
2017-10-17 17:48:04 -07:00
rmzg
8717203fb2 chore(examples): Fixed a typo in examples/proxy.js (#1073) 2017-10-17 17:36:25 -07:00
JoelEinbinder
2b7951473d feat(Browser): make browser.close() to always terminate remote browser
This patch:
- changes `browser.close` to terminate browser.
- introduces new `browser.disconnect` to disconnect from a browser without closing it

This patch: fixes #918, fixes #989 

BREAKING CHANGE:
`browser.close()` will always close a browser, even if it was initialized with
`puppeteer.connect`. To disconnect from a remote browser, use `browser.disconnect()` instead.
2017-10-17 15:35:00 -07:00
Sashiyama Yoshiki
fbee98aa51 chore(examples): add missing argument to search example (#1066)
Fixes #1059.
2017-10-17 15:07:16 -07:00
Andrey Lushnikov
9fab3fd3be chore(readme): use shields.io to display badges 2017-10-17 15:02:54 -07:00
Andrey Lushnikov
0e4477acf7 chore(travis): explicitly define node version in .travis.yml (#1069) 2017-10-17 15:02:09 -07:00
JoelEinbinder
6f97b71616 test: Add a failing test for storing cookies (#1055) 2017-10-16 22:36:13 -07:00
Christopher Deutsch
aebbcf21e8 docs(api): queryObjects returns a Promise<JSHandle> (#1053) 2017-10-16 17:11:05 -07:00
Andrey Lushnikov
a73a67447e docs(api): fix comments in the diagram description 2017-10-16 13:26:04 -07:00
Adi Prasetyo
d0513914e4 chore: Add windows CI (appveyor) (#1046)
This patch adds appveyor to make sure puppeteer works reliably on
windows.

Fixes #955
2017-10-16 11:47:21 -07:00
Andrey Lushnikov
e7eb7b3ccb docs(api): add hierarchical diagram (#1040) 2017-10-16 11:07:06 -07:00
Christian Davis
e3eec24894 docs(api): add missing 'hidden' option on frame.waitForSelector 2017-10-14 22:57:56 -07:00
Andrey Lushnikov
5686d53808 chore: bump version to 0.13.0-alpha 2017-10-14 10:02:07 -07:00
Andrey Lushnikov
b555151c14 chore: mark version 0.12.0 2017-10-14 09:41:06 -07:00
JoelEinbinder
6a8865cd85 feat(keyboard): make keyboard.down generate input event by default (#1016)
This patch starts generating input events for `keyboard.down`, addressing bullet 2 of
#723. With this patch, there's no longer any difference between `keboard.press('a')` and
`keyboard.press('a', {text: 'a'})`.

BREAKING CHANGE:
`keyboard.down('a')` starts generating input event (wasn't the case before).

References #723
2017-10-13 15:22:55 -07:00
Andrey Lushnikov
a02347e3ef feat(Page): implement page.setOfflineMode (#1032)
This patch implements page.setOfflineMode method.

Fixes #63.
2017-10-13 14:41:39 -07:00
Andrey Lushnikov
fd88eb5358 feat(chromium): roll chromium to r508693 (#1031)
This roll enables network throttling in headless: http://crrev.com/508571
2017-10-13 13:52:28 -07:00
Christian Davis
8511db957f feat(page): waitForSelector hidden option (#967)
This patch adds a 'hidden' option for the `page.waitForSelector` method.
2017-10-13 09:11:11 -07:00
JoelEinbinder
8f430fb23d fix(ElementHandle.boundingBox): account for margin, padding, and border in element.boxModel (#1017)
This patch starts relying on border quad to compute element's bounding box.

Fixes #1010
2017-10-12 17:53:59 -07:00
JoelEinbinder
1c528308a8 feat: roll to 508367 (#1027) 2017-10-12 14:56:51 -07:00
JoelEinbinder
053534b4f1 chore: update yarn lock #1025 2017-10-12 11:49:44 -07:00
Sam Verschueren
c310f139a0 feat(Frame): Support options in addScriptTag and addStyleTag (#996)
This patch:
- deprecates injectFile as it was confused with the addScriptTag
- accepts an options object in addScriptTag which supports properties url, path and content.
- accepts an options object in addStyleTag which supports properties url, path and content.

Fixes #949.

BREAKING CHANGE:
- the addStyleTag/addScriptTag have changed;
- the injectFile was removed in favor of (addStyleTag({path:}).
2017-10-12 01:26:44 -07:00
JoelEinbinder
0426e3c068 Roll chromium to 508268 (#1019)
This gets us:

- Plural metrics names https://crrev.com/507885
- TargetInfoChanged on URL changes https://crrev.com/508049
- Sending proper resource types for requests https://crrev.com/667504

Fixes #734
2017-10-12 01:17:06 -07:00
JoelEinbinder
c893bf3684 fix(input) Send .code with keyboard events (#1015)
This patch starts sending proper `.code` field with emulated keyboard events.

References #777.
2017-10-11 18:09:43 -07:00
Andrey Lushnikov
23c0ba0727 feat(Page): introduce Page.queryObjects (#1005)
This patch introduces `Page.queryObjects` and
`ExecutionContext.queryObjects` methods to query JavaScript heap
for objects with a certain prototype.

Fixes #304.
2017-10-11 14:41:20 -07:00
Barry vd. Heuvel
3f9f0f44ff feat(Page.pdf): add 'A6' page format
This patch adds 'A6' page format option to the Page.pdf method.
2017-10-11 13:18:14 -07:00
Eli Sherer
9ecf20fc03 chore: Allow development under Windows platform (#992)
This patch improves life of puppeteer contributor on Windows:

- Setting environment variables using cross-env since Windows requires the SET command.
- Calling Jasmine in the script debug-unit using jasmine's JavaScript binary instead of shell.
- Add /test/test-user-data-dir* to .gitignore since temporary user data directories, in case of test 
  fails, remains in the test directory.
2017-10-11 12:14:13 -07:00
Gleb Azarov
ff08e45785 fix: Remove synchronous operation with file system. (#879)
This patch:
- introduces `helper.promisify` - a simple polyfill for the `util.promisify`. The 
  `util.promisify` could not be used due to Node6 compatibility issues.
- migrates all sync filesystem operations to the async replicas

Fixes #884.
2017-10-11 00:55:48 -07:00
Andrey Lushnikov
7a8aa73466 feat(Page): introduce Page.$$eval method (#1006)
This patch adds a `Page.$$eval` method that runs `document.querySelectorAll`
and passes resulting array to the page function.

Fixes #625.
2017-10-10 23:23:14 -07:00
Andrey Lushnikov
464b6a9616 fix(Page.getMetrics): do not report a few metrics (#1001)
A few of the reported metrics in the Page.getMetrics are already
reported with lifecycle events.

This patch excludes these metrics for now.
2017-10-10 15:22:14 -07:00
Alexei Filippov
b82d3197ed feat(Page): Support Page.getMetrics and metrics event. (#939)
Provides access to the current page performance metrics.
Allows to push page metrics from the page JavaScript with console.timeStamp()

Fixes #309
2017-10-10 14:50:38 -07:00
Austin Kelleher
77d3c2972f test(launcher): add a test for invalid executablePath option
This patch adds a test for invalid executablePath launcher option.
2017-10-10 11:10:26 -07:00
Roberto Toro
13f100bd26 docs(api): fix typo
'Than' was used in a few places instead of 'then'.
2017-10-10 11:07:39 -07:00