Perform automated and live-interactive testing on 3000+ real desktop and mobile devices online.
There could be various reasons why the Playwright automation framework is not able to detect web elements on the web page.
Here are some possibilities with solutions:
const element = await page.$('.my-class');
It will select an element with an ID. And another method is the XPath expression; for instance,
page.$x("//div[@class='my-class']")
Here, it will select the ‘div’ element from class “my class”. It is necessary to use the correct selector for the element you are locating.
You can also use this free XPath Tester tool that is designed to allow users to test and evaluate XPath expressions or queries against an XML document. It helps ensure that the XPath queries are accurate and return the expected results.
Test your websites, web-apps, or mobile apps seamlessly with LambdaTest.
Start Free TestingEarn resume-worthy Selenium certifications that help you land a top job.
Learn MoreTest orchestration and execution cloud of 3000+ browsers and OS
24/7 support
Enterprise grade security
Fastest test execution cloud