Commit Graph

497 Commits

Author SHA1 Message Date
Andrey Lushnikov
0b94fa70eb
chore: stop using console.assert everywhere (#2646)
Since Node 10, `console.assert` no longer throws an AssertionError.
(This is generally good since it aligns Node.js with Browsers.)

This patch migrates all usages of `console.assert` in our codebase.
- All the `lib/` and testing code is migrated onto a handmade `assert`
function. This is to make Puppeteer transpilation / bundling easier.
- All the tooling is switched to use Node's `assert` module.

Fixes #2547.
2018-05-31 16:53:51 -07:00
Andrey Lushnikov
35e3f12afa
fix(workers): swallow errors when auto-detaching from page subtargets (#2649)
Page subtargets (e.g. out-of-process iframes and others) sometimes
die before we send the 'detach' command.

This is harmless to us, but we shouldn't have an unhandled promise
rejection in this case.

Example crash: https://cirrus-ci.com/task/4884032470908928
2018-05-31 16:53:04 -07:00
Joel Einbinder
1c2adf61e9 fix(workers): workaround worker execution context flakiness (#2596)
Some of the worker tests were failing on the bots. After investigating, I found one race in the test, and one race upstream in Chromium which I filed upstream as https://crbug.com/846099. But I added a small hack here as a temporary workaround.

References #2632
2018-05-30 18:08:27 -07:00
Yotam Laufer
469b910a2d feat(page): allow screenshot to return a base64 string (#2586)
Fixes #2566
2018-05-30 14:27:08 -07:00
Yaniv Efraim
7d64d40d66 chore(frame): minor refactor in FrameManager (#2597) 2018-05-25 17:29:11 -07:00
Yaniv Efraim
b8df8bdf4a feat(launcher): launch browser with 'about:blank' by default (#2594)
fixes #2402
2018-05-25 17:26:40 -07:00
Vasyl Pahut
1e07925e26 feat(elementhandle): add elementHandle.$$eval method (#2589)
Fixes #2401
2018-05-25 16:56:51 -07:00
Alex Veligura
32f4c173c8 feat(page): add page.isClosed method (#2588)
Fixes #2501.
2018-05-25 16:53:57 -07:00
Andrey Lushnikov
debfe7e0b1
fix(page): respect timeout 0 in page.waitForFunction (#2563)
The in-page task should not set timeout when timeout is 0.

Fixes #2540.
2018-05-25 16:45:04 -07:00
Paul Irish
6a0627a411 fix(page): Don't report clientside error with a node stack attached (#2572)
This patch stops reporting node.js stacks as part of `pageerror` event.
2018-05-25 16:44:25 -07:00
Joel Einbinder
93fe2b57d6 feat(Page): introduce workers (#2560)
This adds `page.workers()`, and two events `workercreated` and `workerdestroyed`. It also forwards logs from a worker into the page `console` event.

Only dedicated workers are supported for now, ServiceWorkers will probably work differently because they aren't necessarily associated with a single page.

Fixes #2350.
2018-05-21 14:31:11 -07:00
Andrey Lushnikov
51645932b7
refactor: do not pass user options to browser constructor (#2562)
This patch starts explicitly passing allowed options to the `Browser`
class. This, for example, makes it impossible to pass `appMode` as
an option to the `pptr.connect`.
2018-05-16 18:09:59 -07:00
Rafal Jarmolkovič
23d25a6e12 feat(Target): Pass through "background_page" types (#2439) (#2493) 2018-05-16 14:36:34 -07:00
Andrey Lushnikov
3b03ff65c7
feat(BrowserContext): introduce Browser Contexts. (#2523)
This patch introduces Browser Contexts and methods to manage them:
- `browser.createIncognitoBrowserContext()` - to create new incognito
  context
- `browser.browserContext()` - to get all existing contexts
- `browserContext.dispose()` - to dispose incognito context.

Fixes #85.
2018-05-10 13:26:08 -07:00
Denny Ku(kuni)
88b996877f feat(ElementHandle): introduce elementHandle.$eval (#2407)
This patch introduces `elementHandle.$eval` method.

References #2401.
2018-05-08 18:17:59 -07:00
Joel Einbinder
1d225cfa17 fix: allow user gesture restricted code to be run in page.evaluate (#2503)
Fixes #2502
2018-05-04 21:45:16 +03:00
Andrey Lushnikov
a310d57d84
feat(Page): add option to run 'beforeunload' when closing the page (#2478)
Today, `page.close()` method doesn't run page's beforeunload listeners.
This way users can be sure that `page.close()` actually closes the
page.

This patch adds an optional `runBeforeUnload` option to the
`page.close()` method that would run beforeunload listeners. Note:
running beforeunload handlers might cancel page closing.

Fixes #2386.
2018-05-03 01:51:45 +03:00
Yaniv Efraim
e236887bbb feat(Page): report 'Log' domain entries as 'console' events (#2400)
Fixes #1939
2018-04-28 00:40:09 -04:00
Andrey Lushnikov
58c46680f3
fix(Page): fix page.goto to return Response when page pushes new state (#2468)
]Fixes #2411.
2018-04-28 00:15:40 -04:00
Ran Yitzhaki
8fce3195d6 fix(Launcher): exit the process after killing chrome on SIGINT (#2428)
This is a fix for this issue https://github.com/facebook/jest/issues/5748

In the issue, `puppeteer.launch` method is called from jest `globalSetup` script which [is running on the same process as jest](6a77ee37ec/packages/jest-cli/src/run_jest.js (L242)).

Puppeteer catches `SIGINT` in order to kill chrome, but it also replaces the default behaviour of `SIGINT`, [which is to exit with status code 130](https://nodejs.org/dist/latest-v9.x/docs/api/all.html#process_signal_events). In jest's case, the process does not exit, which keeps the process hanging in a weird way.

This PR makes sure that the process exits after killing chrome.
2018-04-25 15:29:14 -07:00
Andrey Lushnikov
37cc9f567d
chore(deps): bump dependencies (#2397)
Fixes #2394
2018-04-17 14:51:03 -07:00
Yaniv Efraim
ed4be10ae3 Chore: replace depracated 'new Buffer' with 'Buffer.from' (#2396)
See [Buffer](https://nodejs.org/docs/latest-v9.x/api/buffer.html) for more details
2018-04-17 13:49:01 -07:00
Arne Martin Aurlien
082b11aa57 Add Page.browser() method (#2387)
Call page.browser() to get the browser instance associated with a
page.

Fixes #2275
2018-04-17 10:37:17 -07:00
Yaniv Efraim
98bb2615ad feat(Tracing): return a buffer from tracing.stop (#2360)
Fixes #2148
2018-04-12 08:26:50 -07:00
Andrey Lushnikov
f8cba455ba
fix(Network): explicitly throw on content request for redirect response (#2352)
DevTools protocol doesn't support returning body of redirect responses.
We should explicitly throw in this case.

References #1896.
2018-04-10 20:22:18 -07:00
Andrey Lushnikov
18f2ecdffd
fix(Launcher): launch chrome with --disable-dev-shm-usage by default (#2351)
Fixes #1834.
2018-04-10 20:05:27 -07:00
Andrey Lushnikov
a7d59b587e
fix(Page): Page.waitForNavigation should correctly handle mixed content (#2339)
This patch teaches Page.waitForNavigation to correctly handle navigation
to pages that have frames that might never load.

These frames include:
- frames which main resource loading was aborted due to mixed-content
  error
- frames that artificially called `window.stop()` to interrupt loading
  themselves

Fixes #1936.
2018-04-10 15:59:41 -07:00
Andrey Lushnikov
5089d2ec2e
fix(BrowserFetcher): ensure executable has proper permissions (#2342)
This patch ensures Chromium executable has permissions to be executed
by non-owner users.

Fixes #2283.
2018-04-10 14:11:59 -07:00
Andrey Lushnikov
fafd156d7b
fix(Page): support anchor navigation (#2338)
This patch fixes puppeteer navigation primitives to work with
same-document navigation.

Same-document navigation happens when document's URL is changed,
but document instance is not re-created. Some common scenarios
for same-document navigation are:
- History API
- anchor navigation

With this patch:
- pptr starts dispatching `framenavigated` event when frame's URL gets
changed due to same-document navigation
- `page.waitForNavigation` now works with same-document navigation
- `page.goBack()` and `page.goForward()` are handled correctly.

Fixes #257.
2018-04-09 23:38:20 -07:00
Andrey Lushnikov
c5902de5d8
fix(Page): fix Page.evaluate with Symbols in arrays (#2340)
Fixes #2295.
2018-04-09 22:02:35 -07:00
Andrey Lushnikov
c86c12e605
fix(Launcher): consume protocol errors when initiating browser.close() (#2332)
Handle errors properly while sending Browser.close()

Fixes #1429.
2018-04-09 14:49:02 -07:00
Andrey Lushnikov
57fa690724
fix(Connection): do not assert that methods always have callbacks. (#2330)
In certain cases, all callbacks could be rejected before we get a
response from transport. This is easily reproducible with `slowMo`
option.

Fixes #563.
2018-04-07 17:59:22 -07:00
JoelEinbinder
294f33b75c chore(types): type check the rest of the protocol (#2328)
This adds events and commands into generated `protocol.d.ts`.
2018-04-07 17:58:52 -07:00
JoelEinbinder
8c54f41552 chore(types): generate a d.ts file for protocol types (#2325)
This uses the `/json/protocol` endpoint to generate type definitions for the protocol.

Currently it is lacking protocol events and commands, but I will add those later.
2018-04-06 18:20:48 -07:00
Andrey Lushnikov
35e34db198
feat(Page): introduce Page.setBypassCSP (#2324)
This patch introduces `page.setBypassCSP` method that allows clients
to ignore Content-Security-Policy for a given page.

Fixes #1229.
2018-04-06 16:35:50 -07:00
Andrey Lushnikov
846c0800b1
feat(Page): Page.addScriptTag should throw when blocked by CSP (#2320)
This patch teaches Page.addScriptTag and Page.addStyleTag to throw
an error when blocked by CSP.

References #1229.
2018-04-06 13:17:55 -07:00
JoelEinbinder
2370618819 chore(types): upgrade to TypeScript 2.8.1 (#2304)
This converts `externs.d.ts` to export a global namespace instead of a UMD global.

See: https://github.com/Microsoft/TypeScript/issues/22969

Fixes #2279.
2018-04-04 14:06:21 -07:00
JoelEinbinder
94c32e4bc8 feat(Launcher): introduce pipe option (#2288)
This patch introduces a new `pipe` option to the launcher to connect over a pipe.

In certain environments, exposing web socket for remote debugging is a security risk.
Pipe connection eliminates this risk.
2018-04-03 15:05:27 -07:00
Yaniv Efraim
dde45faaeb feat(FrameManage): improve errors from frame.waitFor* methods (#2292)
This patch adds title for WaitTask, using it later in generating error messages and
making exceptions much more traceable.

Fixes #2037
2018-03-30 12:37:56 -07:00
Yaniv Efraim
41d5838297 feat(ElementHandle): add ElementHandle.boxModel method (#2256)
This patch introduces ElementHandle.boxModel to get element's
box model.

Fixes #1357
2018-03-29 13:52:28 -07:00
Yaniv Efraim
abb05e069d feat(page): add an option to disable timeout for waitForFunction (#2252)
This patch adds support for `timeout: 0` to disable timeout for the following functions:
- `page.waitForFunction`
- `page.waitForXPath`
- `page.waitForSelector`
and their `frame` counterparts.

Fixes #2200
2018-03-28 16:34:37 -07:00
JoelEinbinder
d46e157f19 feat(Page): page 'close' event (#2232)
This patch adds 'page.close' event.

References #952.
2018-03-28 13:11:51 -07:00
Georgii Dolzhykov
4e1f2e2eb2 fix(Launcher): killing a process can throw (#2102)
In case chrome process was terminated manually, killing the process
might throw 'no process with such pid' exception.
2018-03-15 17:40:24 -07:00
Andrey Lushnikov
ec3025fe84
feat(Network): implement request.redirectChain() api (#2194)
The request.redirectChain() returns all the requests issued to fetch
the resource.

Fixes #1816.
2018-03-15 17:17:38 -07:00
Pig Fang
7d387d8d75 chore(FrameManager): remove extra space (#2187) 2018-03-15 14:04:22 -07:00
Andrey Lushnikov
c082a82547
fix(Launcher): do not detach child process on windows (#2081)
Fixes #2053.
2018-03-15 11:50:16 -07:00
Yaniv Efraim
625c7ebdda feat(FrameManager): add type=module to addScriptTag (#2090)
This patch adds a new "type" option to the `addScriptTag` method that
allows adding "module" tags to the page.

Fixes #2078
2018-03-14 13:07:48 -07:00
Juan Sebastian velez Posada
52d3bc05de feat(Page): introduce url at error message at page.goto (#2174)
Now the error message will come with the url where the error was
generated.

Fixes #2165.
2018-03-12 15:38:05 -07:00
JoelEinbinder
826fe42c48 fix(Network): response.ok should be true for file:// urls (#2152) 2018-03-12 11:34:33 -07:00
Meir017
cad71d9bd9 chore: removed duplicated jsdoc annotation in NetworkManager.js (#2132) 2018-03-07 12:35:15 +03:00
JoelEinbinder
ffe5b63dba chore: refactor Browser.js into seperate files (#2097)
This patch splits Browser.js into multiple separate files.
2018-02-26 12:10:06 -08:00
Andrey Lushnikov
223b59254c
feat(ElementHandle): implement ElementHandle.contentFrame() (#2094)
This patch adds ElementHandle.contentFrame() method that allows
to get a reference to the Frame owned by the iframe.

Fixes #433.
2018-02-23 21:22:53 -08:00
Frankie Bagnardi
56a475f86b feat: elHandle:screenshot captures full element (#1787)
feat: make ElementHandle.screenshot work with large elements

This patch increases the viewport size if the element is bigger than
viewport.

Fixes #1779
2018-02-23 14:13:08 -08:00
Andrey Lushnikov
fc2a10440f
fix(evaluate): throw error when page reloads during page.evaluate. (#2073)
Fixes #2021.
2018-02-22 19:10:17 -08:00
Yaniv Efraim
66887743ea fix(Launcher): fix dumpio bug (#2071)
This patch fixes `dumpio` launcher option.

Fixes #2046
2018-02-22 19:06:13 -08:00
Andrey Lushnikov
80078d9526
fix(Connection): swallow all the ws errors after connection's closed (#2077)
Since ws is closing asynchronously and can yield errors while closing,
we should keep swallowing ws errors after the `ws.close()` method
is called.
2018-02-22 16:23:20 -08:00
Lisa Gagarina
090590a950 docs(api.md): Add more explanation for page.evaluateHandle() (#1867)
Fixes #2062
2018-02-21 17:11:24 -08:00
JoelEinbinder
d75fdb7098 fix(Browser): wait for the page to close in the browser in page.close (#2064)
Fixes #1491
2018-02-21 16:08:29 -08:00
Andrey Lushnikov
fc94f98247
feat(Targets): expose browser target (#2036)
This patch exposes "browser" target to the list of targets.
2018-02-15 13:24:24 -08:00
Andrey Lushnikov
e8a085ccfb
feat(appMode): support pipes for appMode (#2032)
This patch starts using pipes as a transport to
the browser instance instead of websocket.
2018-02-14 17:51:29 -08:00
Andrey Lushnikov
43c0feb2f2
fix(Network): fulfill security details for response redirects (#2025)
This patch:
- starts fulfilling security details for redirect responses
- changes `response.securityDetails()` to return null if the response
  is served over non-secure connection
2018-02-14 16:08:20 -08:00
Andrey Lushnikov
ae22ef30b3
feat(ExecutionContext): introduce ExecutionContext.frame() (#1972)
This patch introduces ExecutionContext.frame() that returns Frame
associated with this Execution Context.

This allows to associate console messages with the originating frame,
if any.
2018-02-13 14:02:44 -08:00
Tomáš Trnka
856c431914 feat(Network): introduce response.securityDetails() method (#1880)
This patch:
- introduces `SecurityDetails` class that exposes a set of fields that describe properties of secure connection
- introduces method `response.securityDetails()` that returns an instance of `SecurityDetails` object.
2018-02-13 11:26:18 -08:00
travch
f3ba436239 Fix: Remove key codes from _pressedKeys Set after keyboard.up() is called (#1928)
keyboard.down() and keyboard.up() both use the _pressedKeys Set, however keyboard.down() adds and searches for the key code, whereas keyboard.up() attempts to delete based on the key rather than the key code.

Fixes #1901
2018-02-12 17:25:38 -08:00
Drew Diamantoukos
b275e66594 chore: Spelling and Markdown Consistency (#1998)
- Adding missing language tags to markdown code blocks.
- Fixed various spelling mistakes my IDE complained to me about.
2018-02-08 22:59:46 -05:00
Andrew Collins
ac1b9a0eb0 feat(Page): add setCacheEnabled(enabled) to Page object (#1609)
This change adds in the `Page.setCacheEnabled(enabled)` method to toggle ignoring cache for each request.

Fixes #1556.
2018-02-08 00:58:48 -05:00
Andrey Lushnikov
a363a733b7
feat: Introduce BrowserFetcher class (#1983)
This patch introduces `BrowserFetcher` class that manages
downloaded versions of products.

This patch:
- shapes Downloader API to be minimal yet usable for our needs. This
  includes removing such methods as `Downloader.supportedPlatforms` and
  `Downloader.defaultRevision`.
- makes most of the fs-related methods in Downloader async. The only
  exception is the `Downloader.revisionInfo`: it has stay sync due to the
  `pptr.executablePath()` method being sync.
- updates `install.js` and `utils/check_availability.js` to use new API
- finally, renames `Downloader` into `BrowserFetcher`

Fixes #1748.
2018-02-07 12:31:53 -05:00
Andrey Lushnikov
ecc3adc279
feat(Response): add Response.fromCache / Response.fromServiceWorker (#1971)
This patch:
- introduces `test/assets/cached` folder and teaches server to cache
  all the assets from the folder
- introduces `test/assets/serviceworkers` folder that stores all the
  service workers and makes them register with unique URL prefix
- introduces `Response.fromCache()` and `Response.fromServiceWorker()`
  methods

Fixes #1551.
2018-02-05 17:59:07 -05:00
Alix Axel
660b65780f feat(Frame): add click(), focus(), hover(), tap() and type() (#1970)
This patch adds frame shortcuts to drive input:
- `Frame.click()`
- `Frame.focus()`
- `Frame.hover()`
- `Frame.tap()`
- `Frame.type()`
2018-02-05 17:58:03 -05:00
Alix Axel
bc6902623a fix: allow timeouts of be 0 (#1964)
This patch fixes timeouts for `puppeteer.launch` and `page.waitForFunction`
to be `0`.

Fixes #1960 .
2018-02-05 17:42:54 -05:00
Andrey Lushnikov
37a1e17461
chore: remove unused parameter in EmulationManager (#1968) 2018-02-05 15:51:43 -05:00
Yaniv Efraim
189deb84c0 feat(Frame): add Frame.evaluateHandle (#1885)
This patch adds Frame.evaluateHandle method. The method is a shortcut
for frame.executionContext().evaluateHandle.

Fixes #1051
2018-01-24 21:16:01 -08:00
Alix Axel
5175d8e692 fix(Page): fix Page.select() behavior to be on par with docs (#1886)
This PR fixes lost functionality that is no longer on-par with the documentation for `Page.select`, namely:

> `...values` <...string> Values of options to select. If the `<select>` has the `multiple` attribute, all values are considered, **otherwise only the first one is taken into account**.

I've also added an accompanying test for this use case.
2018-01-24 21:12:27 -08:00
JoelEinbinder
f2b6016354 chore: switch to npm from yarn (#1878)
This patch:
- migrates CI to use NPM
- drops lockfiles (`yarn.lock`). Lockfiles are ignored by package
  managers when the package is installed as a dependency, so this makes CI closer to the 
  installation our clients run.
2018-01-22 17:11:10 -08:00
Abel Toledano
b61e67d001 feat: add slowMo option to puppeteer.connect (#1864)
This patch introduces a `slowMo` option to the `puppeteer.connect` method. The option
is similar to the one in `puppeteer.launch` and is used to slow down the connection.
2018-01-22 16:45:46 -08:00
Ram Dobson
cb684ebbc4 feat(Page): introduce Page.waitForXPath (#1767)
This patch:
- introduces `page.waitForXPath` method
- introduces `frame.waitForXPath` method
- amends `page.waitFor` to treat strings that start with `//` as xpath queries.

Fixes #1757.
2018-01-22 15:16:20 -08:00
Ian Hunter
59f6d42610 feat: add Page.Events.DOMContentLoaded (#1730)
Fixes #1580
2018-01-16 23:22:44 -08:00
yujiosaka
c866c175f8 fix: page.goto should support pages with self requests (#1391) (#1781)
This patch fixes `page.goto` for websites that re-request document URL with javascript.

Fixes #1391.
2018-01-12 00:16:36 -08:00
Andrey Lushnikov
5368051610
feat: expose raw devtools protocol connection (#1770)
feat: expose raw devtools protocol connection

This patch introduces `target.createCDPSession` method that
allows directly communicating with the target over the
Chrome DevTools Protocol.

Fixes #31.
2018-01-10 19:33:22 -08:00
Radu Aron
ec8e40f1cb feat(Page): Add global navigation timeout setting (#1728)
This patch introduces `page.setDefaultNavigationTimeout` method to override the 
default 30 seconds navigation timeout.

Fixes #1514
2018-01-10 13:04:01 -08:00
Andrey Lushnikov
9634d13be2
fix: requestInterception should play nicely with canceled redirects (#1758)
Since interception events and `loadingFailed` events come from
different processes and are not serialized, we might get `loadingFailed` event and a subsequent outdated `requestIntercepted`.

Short-term, this patch stops assuming that interception events are
aligned with `loadingFailed`.

Long-term, this will be resolved as @caseq completes network
servicification effort in chromium.

Fixes #880.
2018-01-09 22:59:21 -08:00
yujiosaka
f6b7c13316 chore(install): mention yarn along npm in the error message (#1759) 2018-01-09 21:56:04 -08:00
yujiosaka
c29822d663 feat: Attribute network requests to frames (#1646)
This patch introduces `request.frame()` method that returns the frame that
initiated request.

Fixes #1579
2018-01-09 18:47:21 -08:00
yujiosaka
5843f6f775 fix: setRequestInterception and setExtraHTTPHeaders not working together (#1734)
This patch starts lowering header keys while generating request hashes.

Fixes #1729.
2018-01-09 16:52:28 -08:00
Darío Kondratiuk
dcc1b24395 chore(Page): Add missing return comments in addScriptTag and addStyleTag (#1753) 2018-01-09 16:31:41 -08:00
刘祺
71089b0802 feat: teach Downloader to respect redirects (#1741)
This patch adds support for redirects to downloader.

Fixes #1740
2018-01-08 18:10:13 -08:00
刘祺
d7d9623740 fix: downloader host fault tolerance (#1739)
Strip trailing slashes from Downloader download host.
2018-01-08 18:08:27 -08:00
JoelEinbinder
972f44d328 fix: avoid calling jsonValue from waitFor (#1746)
If the success value of `waitForFunction` was not serializable, checking whether it was truthy with `.jsonValue()` might fail. Now I check whether it was truthy inside the page.

Fixes #1737.
2018-01-08 14:14:41 -08:00
yujiosaka
8e9c54a789 feat: introduce browser.userAgent() (#1716)
The patch introduces browser.userAgent() method to retrieve
default browser user agent.

Fixes #1706.
2018-01-05 10:14:30 -08:00
JoelEinbinder
05b1aca21e feat: support JSHandles for page.waitFor* calls (#1712)
This patch:
- teaches page.waitFor* methods to accept JSHandles
- starts returning JSHandles from page.waitFor* calls. 

BREAKING CHANGE: this patch starts allocating `JSHandle`/`ElementHandle` instances for every call to `page.waitFor*` functions. These handles should be disposed manually to avoid memory consumption.

Fixes #1703, fixes #1654, fixes #1724.
2018-01-04 14:49:13 -08:00
Andrey Lushnikov
24354a4879
feat: implement CSS Coverage (#1714)
This patch adds two new methods to the `page.coverage` namespace:
- `page.coverage.startCSSCoverage()` - to initiate css coverage
- `page.coverage.stopCSSCoverage()` - to stop css coverage

The coverage format is consistent with the JavaScript coverage.
2018-01-03 18:21:40 -08:00
JoelEinbinder
f183664d0f feat: rename page.xpath into page.$x, return an array of elements (#1713)
Fixes #1705.
2018-01-03 15:37:08 -08:00
Andrey Lushnikov
d062381978
feat: Implement JavaScript Coverage (#1673)
This patch introduces a new `page.coverage` namespace with two methods:
- `page.coverage.startJSCoverage` to initiate JavaScript coverage
  recording
- `page.coverage.stopJSCoverage` to stop JavaScript coverage and get
  results
2018-01-02 19:53:53 -08:00
yujiosaka
35a5d8bba9 chore(NavigationWatcher): correct closure annotation (#1658) 2017-12-27 20:00:37 -07:00
JoelEinbinder
8a40cd5eef feat(Launcher): allow the default arguments to be overridden (#1623)
This patch:
- adds `puppeteer.defaultArgs()` method to get default arguments that are used to launch chrome
- adds `ignoreDefaultArgs` option to `puppeteer.launch` to avoid using default puppeteer arguments

Fixes #872
2017-12-19 17:51:21 -08:00
Audrius Jakumavicius
f8040cb2a2 feat(pdf): add headerTemplate and footerTemplate to available PDF options (#1625)
This patch allows specifying header and footer templates for PDF printing.

Fixes #373.
2017-12-19 16:54:34 -08:00
JoelEinbinder
60ba8c3af9 feat: add page.xpath (#1620)
This patch adds xpath support with the following methods:
- page.xpath
- frame.xpath
- elementHandle.xpath

Fixes #537
2017-12-19 16:23:45 -08:00
Andrey Lushnikov
b73737302a
fix: convert all getters to methods (#1621)
The patch converts all the getters in the codebase into the methods.
For example, the `request.url` getter becomes the `request.url()`
method.

This is done in order to unify the API and make it more predictable.
The general rule for all further changes would be:
- there are no getters/fields exposed in the api
- the only exceptions are "namespaces", e.g. `page.keyboard`

Fixes #280.

BREAKING CHANGE:
This patch ditches getters and replaces them with methods throughout
the API. The following methods were added instead of the fields:
- dialog.type()
- consoleMessage.args()
- consoleMessage.text()
- consoleMessage.type()
- request.headers()
- request.method()
- request.postData()
- request.resourceType()
- request.url()
- response.headers()
- response.ok()
- response.status()
- response.url()
2017-12-18 17:05:57 -08:00
Jih-Chi Lee
18d5cfa269 fix(Cookies): disallow setting cookies in 'about:blank' page (#1567)
This patch asserts that no cookies are set on `about:blank` and `data:` urls.

References #1411
2017-12-16 01:17:20 -08:00
Andrey Lushnikov
4eaf52fa1d
feat(Browser): introduce browser.process() variable (#1581)
This patch adds a `browser.process()` getter to expose the child process
with running browser.

Fixes #1539.
2017-12-11 12:11:12 -08:00