Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NW.js crashes when launched by Microsoft Playwright (testing utility) #7663

Open
TheJaredWilcurt opened this issue Jan 25, 2021 · 2 comments
Labels
bug has-min-repro Has a minimum reproduction

Comments

@TheJaredWilcurt
Copy link
Member

NW.js Version: 0.51.0-sdk
Operating System: Win 10

Expected behavior

Run playwright with custom path pointing to NW.js executable

Actual behavior

debug log states:

[0124/233623.899:ERROR:resource_bundle.cc(960)] Failed to load C:\Users\wilcurtj\Desktop\playwright2\node_modules\nw\nwjs\chrome_100_percent.pak
Some features may not be available.
[0124/233623.900:ERROR:resource_bundle.cc(960)] Failed to load C:\Users\wilcurtj\Desktop\playwright2\node_modules\nw\nwjs\chrome_200_percent.pak
Some features may not be available.
[0124/233638.941:INFO:child_thread_impl.cc(838)] ChildThreadImpl::EnsureConnected()

How to reproduce

Run playwright and point it to NW.js

const path = require('path');
const { chromium } = require('playwright');

try {
  (async () => {
    const browser = await chromium.launch({
      executablePath: path.resolve(__dirname, 'node_modules/nw/nwjs/nw.exe')
    });
    const page = await browser.newPage();
    // await page.goto('https://nwjs.io');
    await page.screenshot({ path: 'example.png' });

    await browser.close();
  })();
} catch (err) {
  console.log(err);
}

Reproduction attached.

Full command line output from reproduction:

(node:14844) UnhandledPromiseRejectionWarning: browserContext.newPage: Protocol error (Target.createTarget): Browser closed.
==================== Browser output: ====================
<launching> C:\nw-playwright\node_modules\nw\nwjs\nw.exe --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies,LazyFrameLoading --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=C:\Users\owner\AppData\Local\Temp\playwright_chromiumdev_profile-Ijx831 --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --no-startup-window
<launched> pid=10888
[err] [0124/235308.371:ERROR:resource_bundle.cc(960)] Failed to load C:\nw-playwright\node_modules\nw\nwjs\chrome_100_percent.pak
[err] Some features may not be available.
[err] [0124/235308.372:ERROR:resource_bundle.cc(960)] Failed to load C:\nw-playwright\node_modules\nw\nwjs\chrome_200_percent.pak
[err] Some features may not be available.
    at Connection.sendMessageToServer (C:\nw-playwright\node_modules\playwright\lib\client\connection.js:69:15)
    at Proxy.<anonymous> (C:\nw-playwright\node_modules\playwright\lib\client\channelOwner.js:44:61)
    at C:\nw-playwright\node_modules\playwright\lib\client\browserContext.js:95:58
    at ChromiumBrowserContext._wrapApiCall (C:\nw-playwright\node_modules\playwright\lib\client\channelOwner.js:72:34)
    at ChromiumBrowserContext.newPage (C:\nw-playwright\node_modules\playwright\lib\client\browserContext.js:92:21)
    at ChromiumBrowser.newPage (C:\nw-playwright\node_modules\playwright\lib\client\browser.js:58:36)
    at async C:\nw-playwright\play.js:9:18
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14844) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14844) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@ghost
Copy link

ghost commented Feb 18, 2021

It might be related to #586 and the lack of stdin support by the nw process...

@ghost
Copy link

ghost commented Feb 18, 2021

Playwright uses the --remote-debugging-pipe flag which passes the remote debug protocol messages over stdio pipes [in=3, out=4], but as process.stdin is faulty, it crashes.

@ayushmanchhabra ayushmanchhabra added bug has-min-repro Has a minimum reproduction labels Oct 22, 2022
@ayushmanchhabra ayushmanchhabra self-assigned this Apr 20, 2023
@ayushmanchhabra ayushmanchhabra removed their assignment May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug has-min-repro Has a minimum reproduction
Projects
None yet
Development

No branches or pull requests

2 participants