Search code examples
javascripttestingbrowserautomated-teststestcafe

Testcafe native browser dialog not displaying, getNativeDialogHistory is undefined


I'm just getting started with testcafe. The website that I need to test has a native browser window alert that loads before anything displays on the page, and that alert prompts the user for credentials. If the cancel button is clicked, the page is blank except for one word "unauthorized".

When I have my test navigate to the website, I see no window alert at all. The page immediately displays the "unauthorized" message. Is testcafe automatically closing this alert? Neither setNativeDialogHandler nor getNativeDialogHistory are working. How can I have testcafe enter text into two fields in this dialog?

Thank you!


Solution

  • I suppose your site has HTTP authentication. TestCafe can work with HTTP authentication, however, it prevents showing the dialog. This means that everything will work, but you will not see the dialog. Please read the following article: https://devexpress.github.io/testcafe/documentation/test-api/authentication/http-authentication.html