Rayrun
← Back to Discord Forum

How's the best way to Validate a URL

await this.UkBtn.click(); await expect(this.page).toHaveURL('https://uk.com')

is what i've ever used to validate a URL but for now it's not working again

This thread is trying to answer question "How's the best way to Validate a URL?"

5 replies
  • expect.toHaveURL with timeout 60000ms
    • waiting for locator(':root')

Please add await.

await expect(page).toHaveURL(/.*login/);

await commonPage.clickLoginButtonFromTopBar();
            await page.waitForURL(/.*login/, { waitUntil: 'networkidle' });
        })

        await test.step("Then customer should be able to see the login page", async () => {
            await expect(page).toHaveURL(/.*login/);
        })```

Here is another full step,

Looks like your site is not navigating. I recommend ui mode or trace viewer so you can debug it

@_godsown please check the other thread that you started with the same issue, gave you a couple of tips there to help you debug this issue 🙏

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.