Search code examples
navigationautomated-testslocalhoste2e-testingtestcafe

function .navigateTo() don't always work on Testcafe


Some of the URLs are not loading when running testcafe. For example when I try to redirect to the localhost, it is not loading and going straight to the next step.

await t.navigateTo('localhost:8080')

Solution

  • This is because testcafe doesn't support navigateTo without a protocol, so you need to add https:// or http:// before the url. In this case when I changed to:

    await t.navigateTo('http://localhost:8080')
    

    It has worked.