Scenario:
1. Search a Company in the search field.
2. Click that Company from the search results.
3. Repeat Step 1 & 2 for different companies.
Steps:
1. Expand the Click Step --> Goto Objects --> JavaScript
2. Actual xpath generated in the step - evalXPath("//h3[text()=\"PERFORG60\"]");
3. Parameterized xpath to be replaced - evalXPath("//h3[text()=\""+ArgsContext.TC.getParam("P_OrgName")+"\"]");
where P_OrgName is the company name file parameter.
Now your script will click different company names which you input.
1. Search a Company in the search field.
2. Click that Company from the search results.
3. Repeat Step 1 & 2 for different companies.
- I searched for a company PERFORG60.
- In the click step I found that the objects xpath had company name PERFORG60 and that is used to select that company.
- Now I need to make the above steps work for different companies that I input.
- Since the Company names are user inputs, I need to parameterize the Company name PERFORG60 in the xpath.
Steps:
1. Expand the Click Step --> Goto Objects --> JavaScript
2. Actual xpath generated in the step - evalXPath("//h3[text()=\"PERFORG60\"]");
3. Parameterized xpath to be replaced - evalXPath("//h3[text()=\""+ArgsContext.TC.getParam("P_OrgName")+"\"]");
where P_OrgName is the company name file parameter.
Now your script will click different company names which you input.
How to write javascript xpath for similar case when we have a relative xpath like //h3[text()="PERFORG60"]/following-sibling::a[text()="Sometext"]
ReplyDeleteWhere i only want PERFORG60 to be parametrized