Skip to content

[Question] Some _react selectors are deemed not visible #10438

@ghost

Description

Originally described in MarketSquare/robotframework-browser#1519

Hi, I am trying to assert visibility of some React elements using the _react selector strategy introduced in 1.14. I am using Playwright for Python to test the, unminified, React app from https://github.com/alexanmtz/material-sense running locally.

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()
    page.goto("http://localhost:8000")
    print(page.title())
    visible = page.is_visible('_react=Tab[label = "Home"]')  # this element can not be found
    assert visible
    browser.close()

The assertion fails because the element is deemed not visible, but I can't seem to be find why. For some other elements of the app, such as _react=Topbar, it works as expected. I just can't seem to figure out what I might be doing wrong and I'd appreciate any help.

Screenshot from Reac Dev Tools:
2021-11-19_14-08

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