I work on a test automation project on an automotive site, for that I use JavaScript as a programming language with the two Playwright and Cucumber frameworks. So when I did my test I got to a test where I have to manipulate the iframes so I can't access this iframe to click on the button inside and to write on the text fields! I tried a lot of methods among them:
/*`module. exports = async function switchToIframe(page, iframeLocator) { const iframeElement = await page.locator(iframeLocator); const iframe = await iframeElement.frame();
return iframe;
}`*/
but I would still get the error:
/TypeError: Cannot read properties of undefined (reading 'Locator') or frameLocator, ..........
/
So I would like your help if someone can explain to me how to manipulate iframes with playwright and cucumber?
/*`module. exports = async function switchToIframe(page, iframeLocator) { const iframeElement = await page.locator(iframeLocator); const iframe = await iframeElement.frame();
return iframe;
}`*/
/TypeError: Cannot read properties of undefined (reading 'Locator') or frameLocator, ..........
/