Micro Focus QTP (UFT) Forums

Full Version: descriptive programing to click the link on web
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
can any one tell me the descriptive programing for clicking the link on web....like open the yahoo.com and click on the signin link.
Try following

Code:
Dim obj_ChkDesc

Set obj_ChkDesc=Description.Create
obj_ChkDesc(“Class Name”).value = “Link”
Obj_ChkDesc("name").value="Log in"

Browser().page().link(obj_ChkDesc).click

Also you can use following to highlight the link

Code:
Browser().page().link(obj_ChkDesc).Highlight
Code:
systemutil.run "www.yahoo.com"

browser("name:=Yahoo").activate

browser("name:=Yahoo").page("name:=Yahoo_Page").weblink("outerhtml:=Inbox").click
or
Code:
dim des

set des=description.create

des("micclass").value="Link"

set cnt=browser("yahoo").page("yahoo_page").childobject(des)

msgbox cnt.count

for i=0 to cnt.count-1

     val_name=cnt(i).getroproperty("outerhtml")

     if (val_name=Inbox)  then

         cnt(i).click

     end if

Next

set des=nothing
Hi D.Baba-
Please wrap your codes in proper tags, which makes your post more readable. I did it for you this time Smile
@devanggoel - always put your thread title that is relevant to the query not a generalised one, this way we can identify the queries better while searching for it. by the way what do mean by 'programingghhhhhhhf'
------------------------------------------------------------------------------------
1.Descriptive programme for FR login.
------------------------------------------------------------------------------------
Code:
InvokeApplication"E:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
dialog("text:=Login").winedit("window id:=3001").Set"test"
dialog("text:=Login").winedit("window id:=2000").Set"mercury"
dialog("text:=Login").winbutton("window id:=1").Click

Descriptive Programming for Gmail Login Page
Code:
SystemUtil.Run "iexplore.exe","www.gmail.com"
Browser("name:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=Email").Set "abc"
Browser("name:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=Passwd").SetSecure "xyz"
Browser("name:=Gmail.*").Page("title:=Gmail.*").WebButton("name:=Sign in").Click