question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Getting chromium as undefined with playwright-core

See original GitHub issue

Context:

  • Playwright Version: [playwright-core -v1.2.0]
  • Operating System: [Windows (Pro 10 - 1809) & Linux (Ubuntu 20.04)]
  • Node version: [v14.4.0 on Windows, v12.18.0 on Linux (Ubuntu 20.04)]
  • Browser: [Chromium]

Code Snippet

const { chromium } = require('playwright-core');

(async () => {
    try {
        const browser = await chromium.launch({
            headless: false,
            executablePath: 'c:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
        });
        const context = await browser.newContext();
        const page = await context.newPage();
        await page.goto('http://whatsmyuseragent.org/');
        // await browser.close();
    } catch (err) {
        console.log(err);
    }
})();

Describe the bug Getting chromium as undefined

TypeError: Cannot read property 'launch' of undefined
    at C:\Users\Sudhakar_r_r\Desktop\test-playwright\index.js:5:40
    at Object.<anonymous> (C:\Users\Sudhakar_r_r\Desktop\test-playwright\index.js:16:3)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tyrakcommented, Jul 17, 2020

We are developing (and running) a “desktop application” (think of something akin to the carlo architecture) using puppeteer. For various reasons we have made the decision to use the system-wide installation of chromium.

Controlling whether playwright downloads chromium with an environment variable is not very ergonomic: we have to set the variable in every dev box and in every box where we deploy our app; developers have to remember to do PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install instead of npm install (and similarly for npm update).

In general, the reason why package.json and package-lock.json are great is because you can record in them various decisions you have made (e.g. about your dependencies) without having to communicate them to other developers verbally or through documentation. These decisions then propagate to all boxes automatically. They are even versioned! Git remembers when you made changes to them. This lessens the cognitive load of working with the system.

In our current implementation, we have solved the issue of how to signify that we don’t want to use the bundled browser by specifying puppeter-core as a dependency instead of puppeter. It would be great if playwright provided a similar solution. I don’t know if this is the right issue to discuss this, if not, I can open a new one.

0reactions
aslushnikovcommented, Aug 21, 2020

This is fixed now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

56211 - chrome.cookies fails for localhost domains - Monorail
Some companies as the one I am working for do not have dns servers for security reasons. So some internal web based applications...
Read more >
chrome-aws-lambda - npm
The Chromium binary is compressed using the Brotli algorithm. This allows us to get the best compression ratio and faster decompression times.
Read more >
Playwright changelog - Awesome Node.js - LibHunt
It allows testing Chromium, Firefox and WebKit with a single API. All Versions ... #2905 - [BUG] Getting chromium as undefined with playwright-core...
Read more >
playwright-core - UNPKG
The CDN for playwright-core. ... [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295). ... searchParams.get('foo2') === 'bar2');.
Read more >
Chrome Extension NativeMessaging 'connectNative' undefined
To get the sample code for both the Chrome extension and native ... you'll need to fix some bugs in nativeMessaging/host/install_host.sh and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found