2

Trying to learn Jmeter on my own and am a little confused. I utilized the template to record my script. My steps included navigating to various pages and making simple string changes. Ran through everything and all my steps were successful but no data was populated on the UI (the string values did not populate). Someone said it was probably because the website has a dynamic DOM (we use JS methods for Selenium).

I sincerely apologize if I haven't given enough info. Please let me know if you need it. If the dynamic DOM issue is correct, how can I rectify it? I have looked at xPath extractor and CSV data set but nothing substantial.

2 Answers 2

1

The explanation is at JMeter project main page:

JMeter is not a browser

JMeter is not a browser. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever viewed at a time).

So you need to figure out how should the values be populated. If they're present in DOM but not displayed, i.e. hidden via styles, you should be good to proceed.

However if the values are populated from the result of AJAX request - it need to be handled separately. JMeter is capable of executing HTTP requests, no matter whether they are driven by AJAX or not, but JMeter doesn't actually render anything. So just make sure that your test is realistic and requests that are being sent by JMeter match the ones, sent by a browser.

See How To Make JMeter Behave More Like A Real Browser article for few tips and tricks.

0

I recommend that you avoid or heavily modify the recorded script.

It will do things like identify an element by

body table tr tr tr tr td td td div.product_name (css)

or

body//table/tr/tr/tr/tr/td/td/td/div[@class='product_name'] (css)

but neither of these is robust.
You should be looking to use selectors such as div.product_name

The problem isn't with dynamic web sites, xpath or CSV data set, it's that you need to write a robust script and know what each and every step and every element locator does and how to write it in the best way, for example using the ID before class name, etc. The difficulty of doing this will be commensurate with your experience in automating web pages and in programming generally in terms of creating organized structures.
There are many issues and gotchas to learn.

1
  • Thank you for a prompt response! Unfortunately, most of your recommendations went over my head. I guess I have to learn more to be become a newbie first. I will look up what you said. Thanks again!
    – user19003
    Jun 26, 2016 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.