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

[BUG] Cannot open file:// URLs with Firefox #822

Closed
hdorgeval opened this issue Feb 3, 2020 · 3 comments · Fixed by #1132
Closed

[BUG] Cannot open file:// URLs with Firefox #822

hdorgeval opened this issue Feb 3, 2020 · 3 comments · Fixed by #1132

Comments

@hdorgeval
Copy link
Contributor

hdorgeval commented Feb 3, 2020

Context:

  • PlayWright Version: 0.10.0
  • Operating System: Mac OS X 10.15.2 Catalina
  • Extra: [any specific details about your environment]

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:

const browser = await firefox.launch({ headless: true });
const context = await browser.newContext();
const url = `file:${path.join(__dirname, 'foobar.html')}`;
const page = await context.newPage(url);

Describe the bug

const page = await context.newPage(url); will provoke a code freeze

Here is a repo where you could reproduce the problem:
https://github.com/hdorgeval/playwright-controller (the purpose of this repo is to have the same features as exposed by the repo: https://github.com/hdorgeval/puppeteer-core-controller)

and the test in that repo is here:
https://github.com/hdorgeval/playwright-controller/blob/master/src/controller/tests/ctor/controller-ctor.test.ts at line 78

@pavelfeldman
Copy link
Member

Thanks, I can repro! In the snippet below, goto never completes for Firefox when navigating to the file URL.

const playwright = require('playwright');
const path = require('path');

(async () => {
  for (const type of ['chromium', 'webkit', 'firefox']) {
    const browser = await playwright[type].launch();
    const context = await browser.newContext();
    const page = await context.newPage();

    console.log(`${type}: goto`);
    await page.goto(`file:${path.join(__dirname, 'foobar.html')}`);
    console.log(`${type} -> ${await page.evaluate(() => document.body.textContent)}`);

    await browser.close();    
  }
})();

@pavelfeldman
Copy link
Member

@aslushnikov ^^

@pavelfeldman pavelfeldman added the v1 label Feb 5, 2020
@pavelfeldman pavelfeldman changed the title [BUG]Cannot open a local html file with firefox [BUG] Cannot open file:// URLs with Firefox Feb 5, 2020
@aesyondu
Copy link
Contributor

Just encountered the same issue:

https://github.com/aesyondu/javascript-questions/tree/tmp/playwright-sample

snippet:

const path = require("path")
const { firefox } = require("playwright-firefox");
const { chromium } = require("playwright-chromium");
const { webkit } = require("playwright-webkit");

(async () => {
    const browser = await firefox.launch({ headless: false })
    // const browser = await chromium.launch({ headless: false })
    // const browser = await webkit.launch({ headless: false })
    const context = await browser.newContext()
    context.setDefaultTimeout(9999999)
    const page = await context.newPage()

    await page.goto(`file:${path.join(__dirname, "index.html")}`) // 2. firefox not resolving page.goto file:
    console.log("FIREFOX not outputting this")

aslushnikov added a commit to aslushnikov/playwright that referenced this issue Feb 26, 2020
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Feb 26, 2020
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Feb 26, 2020
sand4rt pushed a commit to sand4rt/playwright that referenced this issue Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants