Skip to content

[BUG] page.url() does not include hash #2247

@samuelmaddock

Description

@samuelmaddock

Context:

  • Playwright Version: 1.0.1
  • Operating System: Windows 10 64-bit
  • Node version: 12.16.0
  • Browser: Chromium

Code Snippet

const {chromium, webkit, firefox} = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto('http://localhost:8080/#/test');
  console.log(page.url());
  const hash = await page.evaluate(() => location.hash);
  console.log(hash);
})();

Describe the bug

Using page.url() will not return the URL hash if one is present. The code snippet above will return a URL first without a hash, followed by the actual hash value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions