Skip to content

Commit

Permalink
fix: report hash in page.url()
Browse files Browse the repository at this point in the history
Fixes #2247
  • Loading branch information
aslushnikov committed May 14, 2020
1 parent f743cd9 commit b65de33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/chromium/crPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ class FrameSession {
}

_onFrameNavigated(framePayload: Protocol.Page.Frame, initial: boolean) {
this._page._frameManager.frameCommittedNewDocumentNavigation(framePayload.id, framePayload.url, framePayload.name || '', framePayload.loaderId, initial);
this._page._frameManager.frameCommittedNewDocumentNavigation(framePayload.id, framePayload.url + (framePayload.urlFragment || ''), framePayload.name || '', framePayload.loaderId, initial);
if (!initial)
this._firstNonInitialNavigationCommittedFulfill();
}
Expand Down
8 changes: 8 additions & 0 deletions test/page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,14 @@ describe('Page.url', function() {
await page.goto(server.EMPTY_PAGE);
expect(page.url()).toBe(server.EMPTY_PAGE);
});
it('should not return hashes', async({page, server}) => {
await page.goto(server.EMPTY_PAGE + '#hash');
expect(page.url()).toBe(server.EMPTY_PAGE + '#hash');
await page.evaluate(() => {
window.location.hash = "dynamic";
});
expect(page.url()).toBe(server.EMPTY_PAGE + '#dynamic');
});
});

describe('Page.title', function() {
Expand Down

0 comments on commit b65de33

Please sign in to comment.