microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
67.04k stars 3.68k forks source link

[BUG] using playwright inside electron window with nodeIntegration option #15895

Closed a7medmo7med9 closed 1 year ago

a7medmo7med9 commented 2 years ago

Context:

Code Snippet

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>
    </>
  );
}

1

Describe the bug

I'm using this template for electron Electron-React-boilerplate in electron options i'm using nodeIntegration option to run node js in frontend and it works find with node js api

 mainWindow = new BrowserWindow({
    webPreferences: {
      nodeIntegration: true,
      contextIsolation: false,
    },
  });

but when i try to use time out for page.waitForSelector 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

pavelfeldman commented 2 years ago

It might be that we don't work with the nodeIntegration well.

a7medmo7med9 commented 2 years ago

It might be that we don't work with the nodeIntegration well.

Is there any way to get it work

pavelfeldman commented 1 year ago

Why was this issue closed?

Thank you for your contribution to our project. This issue has been closed due to its limited upvotes and recent activity, and insufficient feedback for us to effectively act upon. Our priority is to focus on bugs that reflect higher user engagement and have actionable feedback, to ensure our bug database stays manageable.

Should you feel this closure was in error, please create a new issue and reference this one. We're open to revisiting it given increased support or additional clarity. Your understanding and cooperation are greatly appreciated.