{"id":1136,"date":"2017-03-10T14:54:49","date_gmt":"2017-03-10T14:54:49","guid":{"rendered":"https:\/\/loadfocus.com\/blog\/?p=1136"},"modified":"2024-02-26T08:05:41","modified_gmt":"2024-02-26T08:05:41","slug":"how-to-use-apache-jmeters-webdriver-sampler-to-load-test-the-ui-of-an-application","status":"publish","type":"post","link":"https:\/\/loadfocus.com\/blog\/2017\/03\/how-to-use-apache-jmeters-webdriver-sampler-to-load-test-the-ui-of-an-application","title":{"rendered":"How to use Apache JMeter&#8217;s WebDriver Sampler to Load Test the UI of an Application"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes read<\/span><\/span><div>Here is how to use <strong>Apache JMeter&#8217;s WebDriver Sampler<\/strong> to load test the UI of the application, and by the UI, I mean load test a user&#8217;s workflow, with entering the web pages, clicking on different links etc.<\/div>\n<div><\/div>\n<div>All you have to do is install the JMeter plugins and make use of the WebDriver Config and WebDriver Sampler plugins which will offer this capability.<\/div>\n<div>Let&#8217;s go into more detail and see how to load test an app with <strong>Apache JMeter&#8217;s WebDriver Sampler<\/strong>.<\/div>\n<div><\/div>\n<div>Here are the steps to Load Test the UI:<\/div>\n<div>\n<ul>\n<li>Start Apache JMeter (see here <a href=\"https:\/\/loadfocus.com\/blog\/2014\/06\/24\/run-apache-jmeter-on-mac\/\">how to run Apache JMeter on Mac<\/a> systems)<\/li>\n<li>Make use of the JMeter Plugins (check here <a href=\"https:\/\/loadfocus.com\/blog\/tech\/2015\/07\/how-to-install-jmeterplugins-extras-and-jmeterplugins-extraslibs\/\">how to use the Apache JMeter plugins<\/a>)<\/li>\n<li>Add a new Stepping Thread Group<\/li>\n<\/ul>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/ui-load-testing-apache-jmeter\/image1-ui-load-testing.png\" width=\"1460\" height=\"655\" \/>\n<ul>\n<li>Add a\u00a0Chrome Driver Config<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/ui-load-testing-apache-jmeter\/image2-ui-load-testing.png\" width=\"1460\" height=\"655\" \/><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>download Chrome Driver for Mac from here &#8211;\u00a0<a href=\"https:\/\/sites.google.com\/a\/chromium.org\/chromedriver\/\">https:\/\/sites.google.com\/a\/chromium.org\/chromedriver\/<\/a><\/li>\n<li>set the Path to Chrome Driver (i.e.\u00a0\/Users\/user\/Downloads\/chromedriver)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/ui-load-testing-apache-jmeter\/image4-ui-load-testing.png\" width=\"1460\" height=\"655\" \/>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>choose if you want to create a new Browser at the start of each iteration (if you don&#8217;t tick this option, the browser instances are going to be reused per each thread, which will cache some of the assets, requests)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p class=\"lead\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/ui-load-testing-apache-jmeter\/image5-ui-load-testing.png\" width=\"1460\" height=\"655\" \/><\/li>\n<li>Add a\u00a0WebDriver Sampler<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/ui-load-testing-apache-jmeter\/image3-ui-load-testing.png\" width=\"1460\" height=\"655\" \/><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>add the following code which will monitor the load time for loading the following webpage https:\/\/www.example.com?uid=${token}<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/ui-load-testing-apache-jmeter\/image6-ui-load-testing.png\" width=\"1460\" height=\"655\" \/><\/li>\n<\/ul>\n<pre class=\"lang-java\"><code>\nWDS.sampleResult.sampleStart()\nWDS.browser.get('https:\/\/www.example.com?uid=${token}')\nWDS.sampleResult.sampleEnd()\n<\/code><\/pre>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>the token variable is previously generate by an HTTP POST\u00a0request<\/li>\n<li>imagine the scenario where you first have to authenticate in order to access a webpage, this is what we do\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>generate a token with an HTTP POST request<\/li>\n<li>extract the token from the HTTP POST response<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/ui-load-testing-apache-jmeter\/image7-ui-load-testing.png\" width=\"1460\" height=\"655\" \/><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>open the webpage with the token as a query parameter and monitor the load time<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>add an Aggregate Report in order to measure the load testing metrics like number of samples, response times, errors, throughput<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/ui-load-testing-apache-jmeter\/image8-ui-load-testing.png\" width=\"1460\" height=\"655\" \/>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>add the Listeners from the JMeter Plugins: Response Times Over Time, Hits per Second and\u00a0Active Threads Over Time to better understand the behaviour of your application while running the load test of the UI<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/d2woeiihr4s5r6.cloudfront.net\/blog\/ui-load-testing-apache-jmeter\/image9-ui-load-testing.png\" width=\"1460\" height=\"655\" \/>\n<p>Run the test at the beginning with only 1 thread in parallel, to create the baseline. The you can increase the number of threads (parallel users) to find performance bottlenecks. Here are more details on <a href=\"https:\/\/loadfocus.com\/blog\/2017\/01\/27\/performance-testing-vs-load-testing\/\">performance testing vs load testing.<\/a><\/p>\n<\/div>\n<div>To test APIs or websites that use Auth, you can checkout our article on <a title=\"How to Test OAuth Secured APIs &amp; Apps using JMeter\" href=\"https:\/\/loadfocus.com\/blog\/2022\/01\/how-to-test-oauth-secured-apis-apps-using-jmeter\/\">How to Test OAuth Secured APIs &amp; Apps using JMeter<\/a>.<\/div>\n<div><\/div>\n<div>Hope this helps.<\/div>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes read<\/span><\/span>Here is how to use Apache JMeter&#8217;s WebDriver Sampler to load test the UI of the application, and by the UI, I mean load test a user&#8217;s workflow, with entering the web pages, clicking on different links etc. All you have to do is install the JMeter plugins and make use of the WebDriver Config&#8230;  <a href=\"https:\/\/loadfocus.com\/blog\/2017\/03\/how-to-use-apache-jmeters-webdriver-sampler-to-load-test-the-ui-of-an-application\" class=\"more-link\" title=\"Read How to use Apache JMeter&#8217;s WebDriver Sampler to Load Test the UI of an Application\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9,6,29,16],"tags":[207,208,206],"class_list":["post-1136","post","type-post","status-publish","format-standard","hentry","category-apache-jmeter","category-load-testing","category-performance-testing","category-selenium-webdriver","category-ui-testing","tag-how-to-load-test-the-ui-of-an-application","tag-jmeter-ui-load-testing","tag-use-apache-jmeters-webdriver-sampler"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts\/1136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/comments?post=1136"}],"version-history":[{"count":3,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts\/1136\/revisions"}],"predecessor-version":[{"id":2976,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/posts\/1136\/revisions\/2976"}],"wp:attachment":[{"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/media?parent=1136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/categories?post=1136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/wp-json\/wp\/v2\/tags?post=1136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}