Can someone explain me how to get the text of the start game button which is present inside iFrame in Playwright JavaScript ,
I tried using below code but that is not working for me
console.log(frame)
// const text= await frame.locator("//div[text()='Start Game']").textContent();
// console.log(text);```
Use frameLocator function to access the content within iFrame.
const btnStart = page.frameLocator('#external-app').locator('text=Start Game');
await btnStart.click();
More details: https://playwright.dev/docs/api/class-framelocator
To access the value or text, you can use page.innerText() or page.inputValue().
More infos here: https://playwright.dev/docs/api/class-page#page-input-value