SlideShare a Scribd company logo
1 of 4
Download to read offline
How to select a random value from dropdown list
using TruClient protocol in LoadRunner?
Selecting Random value from Dropdown List
To select any random value from the dropdown list, follow the below mentioned steps:
1. Record the script in Develop Mode.
2. Go to the dropdown step
3. Expand Arguments
4. Clear the Text
5. Enter Ordinal value as 0.
6. Save the script.
Selecting Random Radio Button value – How to select
random radio buttons using TruClient protocol in
LoadRunner?
To select a random value from the dropdown list follow the below mentioned step:
1. Record the script in Develop Mode.
2. Go to the radio button step.
3. Make sure that Step Action is Click.
4. Expand Object option.
5. Give any name in Name field.
6. The JavaScript code that will be written evaluate the XPath. First we have to find the
XPath expression related to the radio button.To know the XPath of the radio button, Select
the ID Method as XPath à Click on the XPath Expression à Copy the expression in Notepad
Record the step of selecting different radio button option and copy the expression for each
radio button selection. Now find the difference among the expression.
E.g. In the above script, the user can select any one of seat preference option [Aisle,
Window or None] by clicking on the radio button.
Minimum no of seat preference option that needs to be selected = 1 [Min]
Maximum no of option available for selection = 3 [Max]
The Xpath expression for Aisle, Window and None radio button selection are as follows:
As you can see in the above XPath expressions, the dimension of the array label[] is
changing, that means that the selection of the radio button depends on the dimension value
of array label[].
7. Select ID Method as JavaScript.
8. Write the following code in JavaScript field by opening the Edit in JavaScript
Editor button which will appear at the end of the field.
//Declare the variable to hold the random value
var options;
//Assign a random value using the following operation
//(Math.floor(Math.random() * Max – Min + 1) + Min )
options = (Math.floor(Math.random() * 3)+ 1);
//Replace the value of the array on which the selection of radio button is dependent
evalXPath(“/html/body/blockquote/form/table/tbody/tr[5]/td[1]/label[“+options.valueOf()+”]/
input”);
9. Save the script.

More Related Content

Viewers also liked (11)

NANOBOY
NANOBOYNANOBOY
NANOBOY
 
SPICE MODEL of NQ-190AA , LTspice Model in SPICE PARK
SPICE MODEL of NQ-190AA , LTspice Model in SPICE PARKSPICE MODEL of NQ-190AA , LTspice Model in SPICE PARK
SPICE MODEL of NQ-190AA , LTspice Model in SPICE PARK
 
Activities may
Activities may Activities may
Activities may
 
Trivia answers
Trivia answersTrivia answers
Trivia answers
 
Wedding photos
Wedding photosWedding photos
Wedding photos
 
Xcdf
XcdfXcdf
Xcdf
 
Matti 1
Matti 1Matti 1
Matti 1
 
Ovidiu Joita Evolutia Site Urilor
Ovidiu Joita Evolutia Site UrilorOvidiu Joita Evolutia Site Urilor
Ovidiu Joita Evolutia Site Urilor
 
Delibera n.260
Delibera n.260Delibera n.260
Delibera n.260
 
Flussi sdp 03 dicembre 2012
Flussi sdp 03 dicembre 2012Flussi sdp 03 dicembre 2012
Flussi sdp 03 dicembre 2012
 
Projeto Perfumaria
Projeto Perfumaria Projeto Perfumaria
Projeto Perfumaria
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 

Procedure to select Random Value Using Truclient Protocol in LoadRunner?

  • 1. How to select a random value from dropdown list using TruClient protocol in LoadRunner? Selecting Random value from Dropdown List To select any random value from the dropdown list, follow the below mentioned steps: 1. Record the script in Develop Mode. 2. Go to the dropdown step 3. Expand Arguments 4. Clear the Text 5. Enter Ordinal value as 0. 6. Save the script. Selecting Random Radio Button value – How to select random radio buttons using TruClient protocol in LoadRunner? To select a random value from the dropdown list follow the below mentioned step: 1. Record the script in Develop Mode.
  • 2. 2. Go to the radio button step. 3. Make sure that Step Action is Click. 4. Expand Object option. 5. Give any name in Name field. 6. The JavaScript code that will be written evaluate the XPath. First we have to find the XPath expression related to the radio button.To know the XPath of the radio button, Select the ID Method as XPath à Click on the XPath Expression à Copy the expression in Notepad
  • 3. Record the step of selecting different radio button option and copy the expression for each radio button selection. Now find the difference among the expression. E.g. In the above script, the user can select any one of seat preference option [Aisle, Window or None] by clicking on the radio button. Minimum no of seat preference option that needs to be selected = 1 [Min] Maximum no of option available for selection = 3 [Max] The Xpath expression for Aisle, Window and None radio button selection are as follows: As you can see in the above XPath expressions, the dimension of the array label[] is changing, that means that the selection of the radio button depends on the dimension value of array label[].
  • 4. 7. Select ID Method as JavaScript. 8. Write the following code in JavaScript field by opening the Edit in JavaScript Editor button which will appear at the end of the field. //Declare the variable to hold the random value var options; //Assign a random value using the following operation //(Math.floor(Math.random() * Max – Min + 1) + Min ) options = (Math.floor(Math.random() * 3)+ 1); //Replace the value of the array on which the selection of radio button is dependent evalXPath(“/html/body/blockquote/form/table/tbody/tr[5]/td[1]/label[“+options.valueOf()+”]/ input”); 9. Save the script.