Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Incosistent behaviour of grabElementBoundingRect in iframe

Open
#2,770 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, node.js, playwright
Domain
testing-qa

Research direction

Start by reproducing the provided grabElementBoundingRect call inside an iframe with Playwright and WebDriver, comparing the returned coordinates. The issue is resolved when both integrations report iframe element positions consistently relative to the intended viewport.

Written by the indexing model from the issue text.

Description

What are you trying to achieve?

I have an iframe somewhere on my page, with some elements inside it. I am using grabElementBoundingRect to check if an element in the iframe is within the current viewport of the iframe (ie if i have to scroll down to see the element).

I am running my tests mostly with Playwright, but also with WebDriver on some platforms (hello, IE users!)

What do you get instead?

The values returned by grabElementBoundingRect on elements within iframes differ between these WebDriver and Playwright. Playwright returns an absolute x/y position on the screen, while WebDriver returns an x/y position within the iframe.

const elemRect = await within({frame: "#myIframe"}, () => {
    return this.grabElementBoundingRect("#myElement");
});
Details
  • CodeceptJS version: 3.0.4
  • NodeJS Version: v14.15.4
  • Operating System: Ubuntu 18.04
Dominant language
JavaScript
Stars
4.2k
Forks
756
Avg merge
2d 9h
Merged PRs (30d)
16

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from codeceptjs/CodeceptJS

All issues in codeceptjs/CodeceptJS

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.