Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Web fonts can cause the page to move and clicks to fall in the wrong place #787

@jonleighton

Description

@jonleighton

I've been debugging some sporadic spec failures today, where it seems that Poltergeist tries to click the wrong place in the page. Therefore it misses the button I'm trying to click, and my spec fails because the form is never submitted.

We use web fonts in our project. In this case, it seems that what is happening is that since I'm clicking a button very soon after the page has loaded, sometimes Poltergeist computes the click position before the web fonts have loaded but the click itself happens after the web fonts have loaded. And the web fonts cause the page to re-render, so everything moves around a bit. This can cause the click to fall in the wrong place.

More generally, it seems problematic that the page can change between when Poltergeist measures the click position and when it executes the click. Ideally there would be some way to freeze the page, but I don't know if that is at all possible.

For now, I have managed to work around the issue by checking for document.readyState == "complete" on each page load. This may be the next best thing for Poltergeist to implement if freezing the page is infeasible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions