Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP - Code to select a link
#1
Solved: 10 Years, 8 Months, 3 Weeks ago Exclamation 
Hi...

I want to click on the log-in link which is on the right side of the page with descriptive programming...Please Provide me the code..

I have tried this,..

Code:
Browser("Browser").Page("Page).Link("Login").Click

But it throws an error...Help me to solve this
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago Exclamation 
Hi...

I got the answer...Try this

Code:
Dim obj
Set a=Description.Create
a("html tag").value = "A"
a("micclass").value="Link"
a("innerhtml").value="Login"
set obj = Browser("Micclass:=Browser").Page("Micclass:=Page").ChildObjects(a)
x= obj.count
For i=0 to x-1
obj(i).click
Next



Hi..

Got a solution...Try this...

Code:
Dim obj
Set a=Description.Create
a("html tag").value = "A"
a("micclass").value="Link"
a("innerhtml").value="Login"
set obj = Browser("Micclass:=Browser").Page("Micclass:=Page").ChildObjects(a)
x= obj.count
For i=0 to x-1
obj(i).click
Next
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
BROWSER("TITLE:=FIREST 4 CHARACTER.*").PAGE("TITLE:=FIREST 4 CHARACTER.*").LINK("NAME:=X").CLICK

WHERE X--GO AND SPY AT THE "LOGIN LINK THEN U WILL GET THE NAME OF THE LINK.THEN ENTER THAT NAME IN PLACE OF X
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi,

Your expectation is to click on a link available in a page that takes you to the next page.

so, the object that you are accessing is link and the method you have to invoke is click

Step1: Set Mandatory properties for browser, page and link if not already set. (ex. for browser set as name, for page set as title and for link set as name)
Step2: Add all the three objects(browser, page and link) to object repository using Add Objects.
Step3: write code to invoke the the application like

"SystemUtil.run "http://www.google.co.in"

Step4: write code to click on the link

Code:
Browser("name:=Google").Page("title:=Google").link("name:=linkname").click
this should work.

Regards,
Prabhu K
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to select value from google search box dropdown +QTP prajyot 0 2,669 06-28-2017, 06:30 PM
Last Post: prajyot
  how to randomly Select any category link and randomly click on one of its options ? sharavan 0 2,823 11-18-2014, 12:24 AM
Last Post: sharavan
  Date Picker Issue - Unable to select date link dynamically rajkumarsm 1 4,978 09-20-2014, 09:31 AM
Last Post: rajkumarsm
  Do you think it professional QTP code ? learnqtp 0 2,808 06-21-2012, 03:48 AM
Last Post: learnqtp
  Output is different from two different machines for the same block of code in QTP. bdash_10 0 1,961 04-13-2012, 03:38 PM
Last Post: bdash_10

Forum Jump:


Users browsing this thread: 2 Guest(s)