I have a web page.In that i have two links called "gmail"
and "gmail". Both links are look same.One link is at top of
the page and other link is at bottomn of the page. How the
automation tool can be recognized these link and make to
click the link i want?

Answer Posted / kamakshya

Using "Index" ordinal identifier


SystemUtil.Run "iexplore.exe","google.com"
Browser("title:=Google").Page("title:=Google").WebEdit
("name:=q").Set "QTP script"
Browser("title:=Google").Page("title:=Google").WebEdit
("name:=q").Submit
Wait(5)
Browser("name:=QTP script - Google Search").Page
("title:=QTP script - Google Search").WebButton
("name:=Search","index:=0").Highlight
wait(5)
Browser("name:=QTP script - Google Search").Page
("title:=QTP script - Google Search").WebButton
("name:=Search","index:=1").Highlight

Important Note: Interchange the index value and run the
test and observe how the ‘Search’ Button is working.
*********************************************
Using ‘Location’ Ordinal Identifier

SystemUtil.Run "iexplore.exe","google.com"
Browser("title:=Google").Page("title:=Google").WebEdit
("name:=q").Set "QTP script"
Browser("title:=Google").Page("title:=Google").WebEdit
("name:=q").Submit
Wait(5)
Browser("name:=QTP script - Google Search").Page
("title:=QTP script - Google Search").WebButton
("name:=Search","Location:=0").Highlight
wait(5)
Browser("name:=QTP script - Google Search").Page
("title:=QTP script - Google Search").WebButton
("name:=Search","Location:=1").Highlight

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we make one test method dependent on other using testng?

535


what is the dictionary objects in QTP? and what is method of vb script using virtual object wizard........

1547


What is a ‘test plan’? What is a ‘test case’?

551


What is tsl?

568


Hi I need the following information about JMeter 1) How many(max) threads(users) can hit the website using Jmeter? 2) How long(in hours) can we run Jmeter for stress test? (Is there any “Memory full” issue if we run for long time?) 3)What typeof sampler to use for clicking on the link?

2140






Do you know how can we make one test method dependent on other using testng?

563


What steps are needed in developing and running a software test?

544


What is a critical bug in a testing field?

557


What are the different types of scripting techniques for automation testing?

547


What generally is the structure of a framework?

579


What is the purpose of getoptions() method?

590


Tell us what is the alternate way to click on login button?

514


What all different approaches can be used for designing an automation solution?

495


What are the things that one should consider for selecting a project for test automation? For example, stability, etc.

1568


Tell me what is an absolute xpath?

536