playwright
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!
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
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).
Closing per-above as part of triage. If you're still facing an issue, please file a new issue referencing this one!
Thanks!