Reputation: 855
I am trying to understand how the react selectors are working according to https://playwright.dev/docs/selectors#react-selectors . So I am trying some things in playwright sandbox. Seems that the react component cannot be found.
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://www.glassdoor.co.uk/Job/qa-engineer-jobs-SRCH_KO0,11.htm")
page.locator("_react=q[key='1007467366491']").click()
browser.close()
Error:
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for selector "_react=q[key='1007467366491']"
============================================================
Are there any more detailed examples for react out there?
Upvotes: 0
Views: 616
Reputation: 21695
Playwright does not support key filtering at the moment. But you can filter for the job.id
which is part of the props
:
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://www.glassdoor.co.uk/Job/qa-engineer-jobs-SRCH_KO0,11.htm")
page.locator("_react=q[job.id=1007630619432]").click()
browser.close()
Upvotes: 2