Use XPath in Playwright by passing the selector to page.locator() with an xpath= prefix or a leading //, then read text, click, or fill the element.