playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Question] Hi! How can I get my current url? I want to save it in a String like String URL = page.getURL or smth. Thanks!

Open Zahaa7 opened this issue 3 years ago • 2 comments

Zahaa7 avatar Aug 08 '22 10:08 Zahaa7

page.url() https://playwright.dev/docs/api/class-page#page-url

If you need to test it, you should use await expect(page).toHaveURL(); https://playwright.dev/docs/test-assertions#page-assertions-to-have-url

jfgreffier avatar Aug 08 '22 11:08 jfgreffier

Thanks for the pointers @jfgreffier. @Zahaa7 If that doesn't help sort out the issue, please share the minimal amount of code that shows what you're doing and the error (or unexpected behavior you're seeing).

rwoll avatar Aug 08 '22 18:08 rwoll

Closing per-above as part of triage. If you're still facing an issue, please file a new issue referencing this one!

Thanks!

rwoll avatar Aug 11 '22 22:08 rwoll