code for frontend react js
import { chromium } from 'playwright';
export default function App() {
const createBrowser = async () => {
const browser = await chromium.launch({ headless: false });
const context = await browser.newContext();
const page = await context.newPage();
const element = await page.waitForSelector('.products', {
state: 'visible',
timeout: 5,
});
};
return (
<>
<button type="button" onClick={createBrowser}>
CreateBrowser
</button>
</>
);
}
Error
I'm using electron Electron-React-boilerplate template in electron options i'm using nodeIntegration option to run node js api in frontend and it works find with node js api
but when i try to get any element using page.waitForSelector or page.locator('input') or page.fill or page.click thorw this error how can i get playwright fully working with react js at fronted I don't want to use ipcMan to send request to nodejs from frontend to run test