You can achieve this with qunit if qunit is the only tool / testing platform available to you, and the page you will be testing allows for GET requests.
How to do this qunit, you can make an ajax call on the page you are testing using JSONP and get a response. You then claim that certain elements of the answer exist.
For google, google itself has a very complex page structure in the search results, I would not even try to do something like that.
I would use qunit to test javascript components myself without dependencies.
If you are looking for another tool to accomplish this task, I would recommend Selenium, which will do exactly what you want.
Good luck.
source share