0

I am executing my selenium script using Selenium/WebDriver sampler and after the execution of multiple threads, it has been only showing the overall results for all the users. But I want to know the particular time taken by a particular URL that is moving from one to another mapping that I have written in my Selenium Script. Currently, it will show like this :

enter image description here

But my requirement is to get a detailed report for each request. Currently, I have used two thread Groups in which I have used 5 Threads for each group so the total becomes 10 users that will run parallelly and I have to get the detailed report for each user in the dashboard. For more information please see the below script where all data comes from a CSV File.

My Selenium Script is:(Using JavaScript)

WDS.sampleResult.sampleStart()
WDS.browser.get('https://tst-crm.lifec.com/');
var username = WDS.args[0];
var password = WDS.args[1];
var msisdn = WDS.args[2];

WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='username']")).sendKeys(username);
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='password']")).sendKeys(password);
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@value='Login']")).click();
WDS.browser.findElement(org.openqa.selenium.By.id("userDropdown")).click();

WDS.browser.findElement(org.openqa.selenium.By.xpath("(//*[@id='toolbar-search-input'])[3]")).sendKeys(msisdn);
WDS.browser.findElement(org.openqa.selenium.By.xpath("(//*[@type='submit'])[3]")).click();
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(text(),'Lead Generator')][1]/following::*[6]")).click();

WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@href='#orderSummary']")).click();

WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(text(),'View Bill Info')]")).click();

WDS.browser.navigate().back();
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@href='#customerDetails']")).click();

WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(text(),'Update Account Password')]")).click();

WDS.browser.findElement(org.openqa.selenium.By.id("userDropdown")).click();
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(text(),'Logout')]")).click();
WDS.sampleResult.sampleEnd();

My requirement to get the detailed report of every request that I have written in selenium/Webdriver sampler as shared above. Can anyone please help me out from this?

  • If you use scenarios in separate thread group your result will be displayed properly in report. It seems that you have used this in a single thread group – Mohamed Sulaimaan Sheriff Apr 16 at 6:46
1

Just split your script into several WebDriver Samplers like:

  1. First sampler: Open page:

    WDS.sampleResult.sampleStart()
    WDS.browser.get('https://tst-crm.lifec.com/');
    WDS.sampleResult.sampleEnd();
    
  2. Second sampler: Login:

    WDS.sampleResult.sampleStart()
    var username = WDS.args[0];
    var password = WDS.args[1];
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='username']")).sendKeys(username);
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='password']")).sendKeys(password);
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@value='Login']")).click();
    WDS.sampleResult.sampleEnd();
    
  3. etc.

You can also use __threadNum() function somewhere in WebDriver Sampler's label in order to get user-specific timings like:

Open Page - User: ${__threadNum}

More information: The WebDriver Sampler: Your Top 10 Questions Answered

| improve this answer | |
  • Thanks a lot !! That's what I needed, and instead of __threadNum() function, I have directly use the ${USERNAME} in my sampler name that is coming from my CSV Data config file so now the results are shown in a sequence manner. – Rajan Apr 16 at 10:02
  • Hello sir, in this case I'm getting the particular user details ,,,,,but I didn't get the url report in which user was navigated to. I want to show the url report also in which how much time it will take by the url. – Rajan Apr 17 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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