How does one get XY coords of an element without using JS ?

920 views
Skip to first unread message

Justin Yeap

unread,
Sep 20, 2017, 2:36:40 AM9/20/17
to headless-dev
Am trying to avoid using JS via evaluate runtime due to testing/experimental reasons. Would there happen to have a Devtools method for finding element's Viewport's Coords ? Thanks.

Eric Seckler

unread,
Sep 20, 2017, 2:48:40 AM9/20/17
to Justin Yeap, headless-dev

The DOM domain has a command to get the box model of a node (by nodeId or backendNodeId). X/Y coordinates are in the quads. Maybe that's of use?

https://chromedevtools.github.io/devtools-protocol/tot/DOM/#method-getBoxModel


On Wed, Sep 20, 2017, 07:36 Justin Yeap <guach...@gmail.com> wrote:
Am trying to avoid using JS via evaluate runtime due to testing/experimental reasons. Would there happen to have a Devtools method for finding element's Viewport's Coords ? Thanks.

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/b4f2c0f0-e943-4d9e-8fb0-13e688994535%40chromium.org.

Isaac Dawson

unread,
Sep 20, 2017, 2:50:24 AM9/20/17
to Eric Seckler, Justin Yeap, headless-dev

Justin Yeap

unread,
Sep 20, 2017, 2:51:44 AM9/20/17
to Eric Seckler, headless-dev
I think it should work, just wondering would one be right to say backendnodes and nodesids have some overlap, just that backendnodes may not have been pushed to frontend ?

On Wed, Sep 20, 2017 at 2:48 PM, Eric Seckler <esec...@google.com> wrote:

The DOM domain has a command to get the box model of a node (by nodeId or backendNodeId). X/Y coordinates are in the quads. Maybe that's of use?

https://chromedevtools.github.io/devtools-protocol/tot/DOM/#method-getBoxModel

On Wed, Sep 20, 2017, 07:36 Justin Yeap <guach...@gmail.com> wrote:
Am trying to avoid using JS via evaluate runtime due to testing/experimental reasons. Would there happen to have a Devtools method for finding element's Viewport's Coords ? Thanks.

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.

Eric Seckler

unread,
Sep 20, 2017, 2:55:36 AM9/20/17
to Justin Yeap, headless-dev
They are different ID spaces, but yes - nodes corresponding to a known nodeId have always been pushed to the frontend, while you may know backendNodeIds of nodes that haven't been pushed.

On Wed, Sep 20, 2017, 07:51 Justin Yeap <guach...@gmail.com> wrote:
I think it should work, just wondering would one be right to say backendnodes and nodesids have some overlap, just that backendnodes may not have been pushed to frontend ?
On Wed, Sep 20, 2017 at 2:48 PM, Eric Seckler <esec...@google.com> wrote:

The DOM domain has a command to get the box model of a node (by nodeId or backendNodeId). X/Y coordinates are in the quads. Maybe that's of use?

https://chromedevtools.github.io/devtools-protocol/tot/DOM/#method-getBoxModel

On Wed, Sep 20, 2017, 07:36 Justin Yeap <guach...@gmail.com> wrote:
Am trying to avoid using JS via evaluate runtime due to testing/experimental reasons. Would there happen to have a Devtools method for finding element's Viewport's Coords ? Thanks.

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
Reply all
Reply to author
Forward
0 new messages