Andrey Lushnikov
4af0911b90
Use more good flags to run chrome instance.
...
The switches are mostly borrowed from chromedriver launching code.
2017-07-20 12:20:10 -07:00
Andrey Lushnikov
a981594b1d
Revert node's scrolling into view in page.click()
...
This change was not intentional in e33a8f818c
2017-07-20 00:53:14 -07:00
Andrey Lushnikov
e33a8f818c
Support HEADLESS env variable for unit tests
...
This patch makes it possible to run unit tests in non-headless
mode with the following command:
```
HEADLESS=false npm run unit
```
2017-07-19 19:36:22 -07:00
Andrey Lushnikov
a63a0198de
Implement waitFor which survives navigation ( #99 )
...
This patch implements page.waitFor method which survives navigation.
References #89 .
2017-07-19 19:04:51 -07:00
JoelEinbinder
febd747c5b
Inroduce page.press ( #96 )
...
This patch:
- introduces page.press() method
- adds more input tests
References #89
2017-07-19 14:43:07 -07:00
JoelEinbinder
71f8c76f04
Rename keyboard.hold and release to up and down ( #95 )
...
References #89
2017-07-19 14:27:01 -07:00
Andrey Lushnikov
21af495b65
Move screenshot task chain in Browser
...
Currently, it's impossible to do screenshots in parallel.
This patch:
- makes all screenshot tasks sequential inside one browser
- starts activating target before taking screenshot
- adds a test to make sure it's possible to take screenshots across
tabs
- starts waiting for a proper page closing after each test. This might
finally solve the ECONNRESET issues in tests.
References #89
2017-07-19 14:15:16 -07:00
Andrey Lushnikov
2e94f9f67b
Resolve pending callbacks when connection closes
...
This patch:
- resolves pending callbacks in connection once it gets closed
- fixes one of Page.screenshot() tests to wait for all the screenshots
- starts handling ECONNRESET error in test server to avoid throwing with no
good reason
2017-07-19 01:00:02 -07:00
Andrey Lushnikov
55acae40fd
Introduce DEBUG module which traces public API calls
...
This patch improves on DEBUG module to trace all puppeteer's
public API calls.
References #89 .
2017-07-18 21:06:03 -07:00
Pavel Feldman
f154d537f7
Introduce page.goBack/page.goForward ( #93 )
...
This patch introduces page.goBack/page.goForward methods
to navigate the page history.
References #89 .
2017-07-18 19:11:37 -07:00
Pavel Feldman
98c3894c84
Introduce Page.waitForNavigation ( #94 )
...
This patch introduces Page.waitForNavigation which allows to wait
for render-initiated navigation.
This patch also does a nice refactoring, replacing Navigator with NavigatorWatcher which
is not a part of a page state.
References #89
2017-07-18 18:54:24 -07:00
Pavel Feldman
bef9982687
Simplify waitFor code ( #92 )
2017-07-18 12:16:19 -07:00
JoelEinbinder
28265fc313
Fix frame.waitFor to work with complex selectors ( #90 )
...
The frame.waitFor didn't account for multi-level selectors.
This patch fixes this, executing document.querySelector on every DOM mutation.
2017-07-18 02:10:02 -07:00
Andrey Lushnikov
6c1c3a0c45
Return remote object description for unserializable objects
...
This patch starts handling unserializable objects by returning their
description.
Fixes #86 .
2017-07-18 01:34:43 -07:00
Andrey Lushnikov
2ca08b032b
Rename Page's 'consolemessage' event into 'console'
...
This patch:
- renames 'consolemessage' event into 'console'
- improves on 'console' event documentation
References #39 .
2017-07-17 20:38:11 -07:00
Andrey Lushnikov
1a97d8b3c2
Teach 'consolemessage' event to send all the arguments
...
This patch fixes 'consolemessage' event so that it passes
over all the arguments of console API call.
2017-07-17 20:22:45 -07:00
JoelEinbinder
117a128b42
Introduce Page.$ and Page.$$ ( #75 )
...
This patch introduces Page.$ and Page.$$ methods which are
aliases for `document.querySelector` and `document.querySelectorAll`.
Fixes #78 .
2017-07-17 18:56:56 -07:00
JoelEinbinder
bf7698e8f8
Intorduce Page.keyboard ( #74 )
...
Introduce page.keyboard to provide low-level access to the keyboard.
2017-07-17 18:49:52 -07:00
Pavel Feldman
895f69d17a
Add emulation for named devices. ( #72 )
...
This patch introduces page emulation, making it possible to emulate different devices.
2017-07-17 18:13:04 -07:00
Andrey Lushnikov
0414dfa98b
Introduce DEBUG module
...
This patch re-introduces the DEBUG module to expose some of
the puppeteer's internals.
Currently, only the protocol message communication is exposed under
the 'puppeteer:protocol' namespace.
2017-07-17 15:15:07 -07:00
Pavel Feldman
4581ada210
Roll chromium to r486981. ( #87 )
...
This patch rolls chromium to r486981 and prepares
for the introduction of device emulation.
2017-07-17 12:15:06 -07:00
Andrey Lushnikov
b2d2bf822a
Rename Page.printToPDF into page.pdf
...
This patch:
- renames Page.printToPDF into page.pdf
- adds a 'path' option to the page.pdf options instead of a separate
`filePath` parameter
- improves on the documentation for the `page.pdf`
References #39 .
2017-07-17 10:37:33 -07:00
Aleksey
ac75455983
Fixed page.waitFor ( #81 )
...
The original implementation didn't account for frames.
2017-07-14 15:55:38 -07:00
Andrey Lushnikov
560b817d7f
Make page.url() return URL synchronously.
...
page.url() is just a shortcut to page.mainFrame().url().
References #39 .
2017-07-14 14:05:27 -07:00
Andrey Lushnikov
34a96a8462
Rename navigation option 'waitFor' into 'waitUntil'.
...
This patch renames navigation option 'waitFor' into 'waitUntil' to
avoid confusion with 'page.waitFor' call.
References #39 .
2017-07-14 13:59:36 -07:00
Andrey Lushnikov
76415e1be5
[doc] distinct naming for functions which are evaluated in page context
...
This patch renames all the function parameters which are executed in
page context into 'pageFunction'.
2017-07-14 13:51:22 -07:00
Andrey Lushnikov
235001bab3
[doclint] validate return statements
...
This patch teaches doclint to validate presence of return statements.
It also adds a bunch of documentation to the api.md.
References #14 .
2017-07-14 13:04:15 -07:00
JoelEinbinder
4bd855c66b
Use getBoundingClientRect instead of DOM.BoxModel ( #76 )
...
This patch re-implements `page.click()` and `page.focus()` using
`page.evaluate`
2017-07-13 18:32:34 -07:00
Andrey Lushnikov
64ebcdba9f
Do not close readline after reading remote debugging port
...
Closing readline interface results in closing underlying
stream. We don't want this.
2017-07-12 19:15:21 -07:00
Andrey Lushnikov
38e6f53cc7
[doclint] add linting for class properties
...
This patch:
- adds linting for class properties
- adds documentation for the missing class properties
References #14 .
2017-07-12 09:45:08 -07:00
Andrey Lushnikov
60621b8815
Fix Click unit tests on Mac OS X
...
This patch brings screenDPI back in clicking equation, which was
regressed in afb096cfd7
.
2017-07-11 22:35:22 -07:00
Aleksey
b77ae4b77c
Properly cleanup FrameManager._frameIdToExecutionContextId. ( #73 )
2017-07-11 21:52:09 -07:00
Andrey Lushnikov
b0a2cf662e
Roll chromium to r485143
2017-07-11 19:38:20 -07:00
Andrey Lushnikov
7765760186
[doclint] Start linting method arguments
...
This patch introduces a general Documentation.diff method, which
produces a diff of two documentations.
With this, the patch teaches documentation linter to lint method arguments.
References #14 .
2017-07-11 16:43:41 -07:00
Pavel Feldman
afb096cfd7
Disable DOM domain after each operation. ( #71 )
...
It's very heavy to have DOM domain enabled. This patch keeps DOM domain disabled after each use.
2017-07-11 16:25:25 -07:00
Andrey Lushnikov
279cd4c9fb
Remote Browser's remoteDebuggingPort option
...
This patch remove remoteDebuggingPort option. Instead, browser
is launched with '--remote-debugging-port=0' flag, letting browser
to pick any port. The puppeteer reads the port number from the
browser's stderr stream.
This change cuts average browser start time from 300ms to 250ms
on my machine. This happens since puppeteer doesn't have to probe
network once every 100ms, waiting for the remote debugging server to
instantiate.
Fixes #21 .
2017-07-11 08:30:41 -07:00
Andrey Lushnikov
d120e7e426
properly cleanup exit process listener as browser closes
2017-07-11 08:11:16 -07:00
Andrey Lushnikov
b6d0ebfbf2
Run headless chromium with --hide-scrollbars
...
This patch runs chromium in headless mode with the --hide-scrollbars
flag so that it doesn't spoil screenshots.
Fixes #68 .
2017-07-10 18:58:29 -07:00
Andrey Lushnikov
50d9c186b5
Change Page.navigate to return main resource response
...
This patch changes Page.navigate API:
- Page.navigate now resolves to the main page response
- Page.navigate throws errors if there's no main page response,
e.g. in case of SSL errors, max navigation timeout,
or invalid url.
This patch also adds httpsServer with a self-signed certificates
for the testing purposes.
Fixes #10 .
2017-07-10 18:50:06 -07:00
JoelEinbinder
da0cde1b45
Implement Page.uploadFile ( #61 )
...
This patch implements `Page.uploadFile` method to support file upload inputs.
2017-07-10 11:21:46 -07:00
JoelEinbinder
739c1566a9
Add tests for all public methods on Page ( #62 )
2017-07-10 10:09:59 -07:00
Andrea Cardaci
ff4a389274
Fix watchdog timer cleanup ( #64 )
...
Fix a bug in f7cd004
which prevents the cleanup of the watchdog timer, thus keeping the Node.js process alive for this._maxTime msec no matter what.
2017-07-08 08:54:28 -07:00
Andrey Lushnikov
f7cd0048af
Cleanup navigator logic
...
This patch cleans up navigator logic. (This is a result of a pair
programming with @pavelfeldman).
2017-07-07 15:46:05 -07:00
Aleksey
090ecfa6b9
Added frame.waitFor(selector) ( #59 )
...
This patch adds `frame.waitFor(selector)` method.
Fixes #42 .
2017-07-08 01:39:02 +03:00
Andrey Lushnikov
34f043d821
Implement browser.stdout and browser.stderr streams
...
This patch adds browser.stdout and browser.stderr streams.
These streams allow to get the browser instance output, e.g.
```js
browser.stderr.pipe(process.stdout);
```
2017-07-07 20:49:17 +03:00
Andrey Lushnikov
c8664319ed
Make browser._ensureChromeIsRunning idempotent
...
The _ensureChromeIsRunning should launch chrome only once
and return the same promise for all its clients.
2017-07-06 18:20:01 -07:00
Paul Irish
6c7ae41ae6
fix page.injectFile and add test. ( #52 )
...
This line within `injectFile` wasn't doing much of anything:
```js
let expression = fs.readFile(filePath, 'utf8', (err, data) => callback({err, data}));
```
* That's fixed.
* A path error in examples/features.js is fixed.
* Test added for injectFile.
2017-07-07 02:09:23 +03:00
Andrey Lushnikov
19a8d74d3c
Implement Body interface for both Request and Response
...
This patch partially implements Fetch API's [Body](https://developer.mozilla.org/en-US/docs/Web/API/Body )
interface for both Request and Response.
Fixes #26 .
2017-07-06 12:17:01 -07:00
Andrey Lushnikov
64fed38c60
Rename Page.Events.Error into Page.Events.PageError
...
The 'error' event has a special treatment in Node:
https://nodejs.org/api/events.html#events_error_events
To avoid this, this patch renames the 'error' event into
the 'pageerror'.
2017-07-06 11:22:32 -07:00
Andrey Lushnikov
19e882f505
fix switch statement indentation in FrameManager
2017-07-06 10:46:19 -07:00