Commit Graph

25 Commits

Author SHA1 Message Date
Andrey Lushnikov
5368051610
feat: expose raw devtools protocol connection ()
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 .
2018-01-10 19:33:22 -08:00
JoelEinbinder
f183664d0f feat: rename page.xpath into page.$x, return an array of elements ()
Fixes .
2018-01-03 15:37:08 -08:00
JoelEinbinder
60ba8c3af9 feat: add page.xpath ()
This patch adds xpath support with the following methods:
- page.xpath
- frame.xpath
- elementHandle.xpath

Fixes 
2017-12-19 16:23:45 -08:00
Christopher Dieringer
b0b22199f9 fix(ElementHandle.screenshot): account for scroll ()
Currently, `elementHandle.screenshot` passes bounding box into the `page.captureScreenshot` 
method.
This is wrong since `captureScreenshot` accepts viewport, not bounding box.

This patch uses layout metrics to convert bounding box into viewport.

Fixes .
2017-11-10 16:02:52 -08:00
Alix Axel
7d18275fb9 Test: add tests to cover clicking checkbox ()
This patch adds tests to make sure clicking both checkbox and its label
works.

These are regression tests to cover the upstream fix, rolled in .
2017-11-07 20:38:22 -08:00
JoelEinbinder
b58d319926 fix(Page.click): throw a meaningful message for invisible elements ()
This patch starts throwing a meaningful error message when trying to click the hidden
node.

References 
2017-11-07 13:54:40 -08:00
Andrey Lushnikov
c9a26e11f1
fix(ElementHandle): teach ElementHandle to work with shadowdom ()
Elements in shadow dom erroneously considered that they were detached
from document.

This patch starts using `Element.isConnected` instead of
`document.contains()` call.

Fixes .
2017-10-31 12:02:16 -07:00
Adam Stankiewicz
5ffbd0d221 feat(ElementHandle): add ElementHandle.$ and ElementHandle.$$ ()
This patch adds `ElementHandle.$` and `ElementHandle.$$` methods to query nested
elements.

Fixes 
2017-10-27 02:08:58 -07:00
JoelEinbinder
8f430fb23d fix(ElementHandle.boundingBox): account for margin, padding, and border in element.boxModel ()
This patch starts relying on border quad to compute element's bounding box.

Fixes 
2017-10-12 17:53:59 -07:00
Eli Sherer
7e28dbafb5 feat(ElementHandle): add EH.boundingBox and EH.screenshot
This patch:
- adds `ElementHandle.boundingBox()` method to get bounding box of element relative
  to the page
- adds `ElementHandle.screenshot()` method to capture a screenshot of an element
2017-10-09 23:14:09 -07:00
JoelEinbinder
e59172de83 chore: Use Typescript to lint JSDoc annotations ()
This patch starts using typescript to lint JSDoc annotations.

Note: this uses typescript's bleeding edge. We should migrate to stable once
it has all the necessary bugfixes.

References .
2017-10-09 22:31:40 -07:00
JoelEinbinder
52f92c9891 fix(input): clicking an element should take into account frame position () 2017-10-09 13:23:36 -07:00
JoelEinbinder
0af0d7dba5 feat(Input): Add keyboard methods to elementHandle ()
This patch:
- adds input methods to ElementHandle, such as ElementHandle.type and ElementHandle.press
- changes `page.type` to accept selector as the first argument
- removes `page.press` method. The `page.press` is rarely used and doesn't operate with selectors; if there's a need to press a button, `page.keyboard.press` should be used.

BREAKING CHANGE: `page.type` is changed, `page.press` is removed.

Fixes .
2017-10-07 00:28:24 -07:00
Andrey Lushnikov
0d0f9b7984 feat(JSHandles): introduce JSHandles ()
This patch:
- introduces ExecutionContext class that incapsulates javascript
  execution context. An examples of execution contexts are workers and
  frames
- introduces JSHandle that holds a references to the javascript
  object in ExecutionContext
- inherits ElementHandle from JSHandle

Fixes .
2017-10-06 15:35:02 -07:00
Andrey Lushnikov
9292a56eaf [api] Teach page.evaluate to accept element handles as parameters ()
This patch:
- teaches `page.evaluate` to accept ElementHandles as parameters
- removes `ElementHandle.evaluate` method since it's not needed any
  more

References 
2017-09-11 19:20:02 -07:00
Andrey Lushnikov
0bea42bd8c Do not leave dangling promises when sending messages over protocol ()
It's very bad to have 'unhandled promise rejection' that can't be
handled in user code. These errors will exit node process in a near
future.

This patch avoids 'unhandled promise rejection' while sending protocol
messages.

This patch:
- introduces `puppeteer:error` debug scope and starts using it for all
  swalloed errors.
- makes sure that every `client.send` method is either awaited or its
  errors are handled.
- starts return promises from Request.continue() and Request.abort().
- starts swallow errors from Request.contine() and Request.abort().

The last is the most important part of the patch. Since
`Request.continue()` might try to continue canceled request, we should
disregard the error.

Fixes .
2017-09-11 16:21:51 -07:00
JoelEinbinder
64124df62f [api] add touchScreen.tap ()
This patch:
- adds `page.touchscreen` namespace, similar to `page.mouse` and `page.keyboard`.
- adds tapping to multiple layers:
  - `page.touchscreen.tap`
  - `page.tap` - convenience method which accepts selector
  - `elementHandle.tap`

Fixes  and .
2017-09-01 19:03:51 -07:00
JoelEinbinder
42fa3af659 Remove promise jsdoc ()
This patch removes unnecessary "promise" return types in jsdoc for async functions.
2017-08-31 17:58:07 -07:00
Andrey Lushnikov
62ececb1c7 Implement page.$eval ()
This patch:
- implements page.$eval and frame.$eval
- drops elementHandle.attribute() method in favor of the page.$eval

References 
2017-08-31 15:38:01 -07:00
Batiste Bieler
77600c6c5e Implement ElementHandle.attribute() method ()
This patch implements ElementHandle.attribute() method to fetch a value of
element's attribute.
2017-08-29 11:24:32 -07:00
Eric Bidelman
1f9b4fb4c8 Change let into const ()
This patch:
- changes `let` into `const` throughout codebase
- adds eslint check to prefer const over let
2017-08-21 16:39:04 -07:00
JoelEinbinder
5f0afd5547 Move uploadFiles onto ElementHandle ()
This patch:
- removes the `page.uploadFile` method
- adds `elementHandle.uploadFile` method.

Motivation: `elementHandle.uploadFile` is rarely used, so it doesn't worth it
to keep it on page.
2017-08-17 14:53:37 -07:00
Andrey Lushnikov
44c15220f9 Rename ElementHandle.release into ElementHandle.dispose ()
The ElementHandle.release feels related to ElementHandle.click.
The dispose is a more clear name.
2017-08-16 00:49:20 -07:00
Aleksey
56eab00fa7 Roll chromium to r494365 ()
This patch:
- rolls chromium to r494365
- starts using Runtime.evaluate(awaitPromise: true), with new semantic
  we can avoid additional Runtime.awaitPromise call
- stops resolving promises for Console event
2017-08-15 17:35:59 -07:00
Andrey Lushnikov
af89e893e7 Implement basic element handles ()
This patch implements basic element handles which a backed with remote objects.

Fixes 
2017-08-15 14:54:02 -07:00