79316146

Date: 2024-12-29 18:48:51
Score: 1.5
Natty:
Report link

There is no way an element returns an empty bounding client rect, you just need to look a bit harder.

For example.com:

cy.visit('https://example.com');

cy.get('h1')
  .first()
  .then(($target) => {
    let coordsDrop = $target[0].getBoundingClientRect();
    cy.log('coordsDrop', coordsDrop);
    console.log('coordsDrop', coordsDrop);
  })

The log:

enter image description here

Click the log entry:

enter image description here

or use consolg.log(coords)

enter image description here

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Mipcia