Skip to content

Playwright::Error: Element is not attached to the DOM #83

@adamreisnz

Description

@adamreisnz

I am frequently running into this error when using the Capybara Playwright driver to click on elements:

Playwright::Error: Element is not attached to the DOM

It seems more likely to occur when a lot of actions are being taken on the page.

Sample code that causes it:

select_input = page.find("[test-id='someTestId']")
select_input.click
option = select_input.find('li[role="option"]', text: 'foo')
option.click # This will trigger the error

The select input and option all exist on the page 100% and are all clickable.

Is there any way to prevent this error or any viable workarounds?
The suggested workarounds found when googling don't seem to work/apply as we're working through Capybara here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions