Automated browser testing: how to test JavaScript on web pages?

I am trying to write an application that will test a series of web pages programmatically. The tested web pages contain embedded JavaScript that change the structure of the HTML at completion. Then you need to take the final HTML (after executing the built-in JavaScript) and compare it with the known output.

Essentially, Input ---> Output for the test application:

URL --- [get HTML] ---> HTML --- [execute JS, then compare] ---> PASS / FAIL

Here is the challenge:

I was not able to find a solution that can take the HTML code that I am extracting from the URL and process JavaScript as a browser, and generate the final HTML that the user can see from the “View Source” on the same page in the browser.

It would be very surprising if this kind of approach has not been done before, so I hope someone out there knows a suitable solution for this application / problem? If at all possible, I hope for a solution that integrates with .NET (I tried using WebBrowser, no luck). However, if there is an existing third-party application that can do just that, it will be perfectly acceptable.

Thanks in advance for the suggestions!

  • Dave
+4
source share
1 answer

The standard name for testing is based on the Selenium browser. He should be able to do what you are looking for.

+3
source

Source: https://habr.com/ru/post/1308694/


All Articles