JMeter and JavaScript
When I make HTTP Request in JMeter I get Response data like "This page uses JavaScript and requires a JavaScript enabled browser." How is it possible to fix this problem开发者_如何学编程.
JMeter is not a browser, and does not interpret the JavaScript in downloaded pages.
From the JMeter wiki:
JMeter does not process Javascript or applets embedded in HTML pages.
JMeter can download the relevant resources (some embedded resources are downloaded automatically if the correct options are set), but it does not process the HTML and execute any Javascript functions.
If the page uses Javascript to build up a URL or submit a form, you can use the Proxy Recording facility to create the necessary sampler. If this is not possible, then manual inspection of the code may be needed to determine what the Javascript is doing.
Depending on what you are doing, you could create an execution test using Selenium IDE for Firefox. The test will run in your browser so the JavaScript will also run. Note though that I never used Selenium as a substitute for JMeter and don't know about common features to both the tools.
I suppose you can use the WebDriver plugin to run real browser tests (IE/Firefox/Chrome/Selenium).
There is good documentation here
You can add WebDriver to JMeter test to fully evaluate the page rendering.
Web Driver Sampler automates the execution and collection of Performance metrics on the Browser (client-side). A large part of performance testing, up to this point, has been on the server side of things. However, with the advancement of technology, HTML5, JS and CSS improvements, more and more logic and behaviour have been pushed down to the client. This adds to the overall perceived performance of website/webapp, but this metric is not available in JMeter. Things that add to the overall browser execution time may include:
- Client-side Javascript execution - eg. AJAX, JS templates
- CSS transforms - eg. 3D matrix transforms, animations
- 3rd party plugins - eg. Facebook like, Double click ads, site analytics, etc
All these things add to the overall browser execution time, and this project aims to measure the time it takes to complete rendering all this content.
Official guide: https://jmeter-plugins.org/wiki/WebDriverTutorial/
You need to add HTTP Cookie/Cache Manager to your thread in order to solve this.
精彩评论