It depends on what you focus on, functionality or performance.
Functions
When monitoring functionality, you are aimed at automatically ensuring the correct functioning of the web application. Typically, this is a large part of the ongoing integration process - and less than part of production monitoring. This can be done using HtmlUnit, Selenium or WebDriver. HttpUnit is no longer recommended (API is lower-level, JavaScript is not very well supported, less widely accepted, fewer bug fixes and improvements).
HtmlUnit simulates a browser. Thus, you can never be sure that your application behaves exactly the same as in a real browser. This is especially important for complex Ajax applications. This compares to all the minor incompatibilities between FireFox and Internet Explorer. Pros: Headless, easy to understand. Cons: risk of undetected incompatibility.
Selenium remote control real browser. In our installation, we could not use it without a head, especially with Internet Explorer. But if you insert it into a virtual machine, it works without a head. If your application is accessible over the public Internet, you can even use Selenium Grid and the pre-configured virtual machine from Amazon Elastic Cloud EC2. Advantages of Selenium: compatibility in the real world, simple scripting. Cons: Headless only in a virtual machine, overhead for performance, more complicated setup of runtime, modeling stresses of simultaneous users only in the cloud.
Prior to version 1.5, Selenium uses a part of JavaScript called Selenium Core to control the browser. If your application has security restrictions for JavaScript, Selenium may not work correctly.
WebDriver uses a specific interface for each browser, for example. for FireFox, an extension for Internet Explorer Automation Controls. In addition, it uses an operating system, for example. to simulate keystrokes. It is more powerful, reliable and reliable than Selenium Core. Starting with Selenium 2.0, WebDriver is integrated into Selenium. But Selenium 2.0 is still beta.
Performance
You specify the measurement using a timer, and you specify the rendering times. When monitoring the performance of a web application, you want to receive a warning when using the application in real time is no longer possible due to excessive response time.
In this case, you are usually not interested in accurate millisecond results. You can use one of the tools mentioned above. For example, a browser with Selenium Core is slower than a real-world browser, but this is of little relevance for continuous monitoring.
If you absolutely need accurate measurements, none of the above are suitable. You must distinguish between client-side duration and network length plus server.
Client side duration is required for rendering HTML and for executing JavaScript. It does not depend on the number of simultaneous users. You can measure it once, for example. with firebug . You do not need to constantly monitor it.
The duration of the network plus the server part is necessary to transmit the request to the server, process the request and generate a response and transmit the response to the client. They vary depending on network usage and the number of concurrent users. You can accurately measure and control them, for example, using JMeter . But with complex Ajax functionality, simulating the right client requests in JMeter is a daunting task. Pros of JMeter: accurate measurement, the ability to emphasize the application with many concurrent users. Cons: Limited to Ajax, a lot of effort to create a request.