How to click on the link available in the web table

9,422 views
Skip to first unread message

avinash vl

unread,
Mar 4, 2011, 9:37:52 AM3/4/11
to mercu...@googlegroups.com

Hi,

I'm working with yahoo mail and my intent is to click on a certain mail with the "Subject<something>"

The following code works fine, if the mail subject is unique.

 

Browser("name:=Inbox.*").Page("title:=Inbox.*").Link("text:="&linkName).Click

 

But when the subject repeats, I need to click on the latest mail (ie 1st from the web table) so I tried the following code.

 

rowCount=Browser("Inbox (19) - Yahoo! Mail").Page("Inbox (19) - Yahoo! Mail").WebTable("Inbox").GetROProperty("Rows")

 

For i=2 to rowCount

If  Browser("Inbox (19) - Yahoo! Mail").Page("Inbox (19) - Yahoo! Mail").WebTable("Inbox").GetCellData(i,7)=linkName Then

...........

I'm stuck here.

 

Please suggest me a method to click on the link available in the web table

Please correct me if I’m wrong



Thanks and regards,

Avinash

govind sirvi

unread,
Mar 5, 2011, 10:22:25 AM3/5/11
to mercu...@googlegroups.com
Hi Avinash,

Use the below code .The below code clicks on a latest mail with a subject

rowNum=Browser("Inbox (19) - Yahoo! Mail").Page("Inbox (19) - Yahoo! Mail").WebTable("Inbox").GetRowWithCellText("Subject",7,1)

set LinkObj=Browser("Inbox (19) - Yahoo! Mail").Page("Inbox (19) - Yahoo! Mail").WebTable("Inbox").ChildItem(rowNum,7, "Link",0)
LinkObj.click


I hope this is what u r looking for,kindly do reply to this mail if u r facing any problem

Thanks and Regards,
Govind

--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en



--
Thanks and Regards,
Govind

avinash vl

unread,
Mar 7, 2011, 12:44:44 AM3/7/11
to mercu...@googlegroups.com, govind sirvi
Hi Govind,

Thanks for your reply.
Its working fine...:)

sachin mahajan

unread,
Jul 25, 2012, 12:28:33 PM7/25/12
to mercu...@googlegroups.com
Hi Zaheer,

u can use the below code for clicking for particular mail

rows=Browser("name:=Gmail - Inbox").page("title:=Gmail -
Inbox").webtable("html tag:=TABLE","name:=t").GetROProperty("rows")
For i=0 to rows
a=Browser("name:=Gmail - Inbox").page("title:=Gmail -
Inbox").webtable("html tag:=TABLE","name:=t").GetCellData(i,2)
print(a)
If a ="media soft" Then
Set objects=Description.Create
objects("html tag").value="A"
' objects("name").value="t"
set o=Browser("name:=Gmail - Inbox").Page("title:=Gmail -
Inbox").webtable("html tag:=TABLE","name:=t").childobjects(objects)
o(i).Click
Exit For
End if

Next

On 7/25/12, Hamza Zaheer <hamza....@gmail.com> wrote:
> Hi All,
>
> I am using the same code, but I am getting Object Not Found error, any
> suggestions?

shashi qa

unread,
Jul 27, 2012, 6:17:07 AM7/27/12
to mercu...@googlegroups.com
Hope this will work for you this is for Gmail but i think you can change it to Yahoo either




Dim bro
Set bro = description.Create
bro("micclass").value = "browser"
dim pag
Set pag = description.Create
pag("micclass").value = "page"

Dim un
Set un = description.Create
un("html id").value = "Email"
Dim pwd
Set pwd = description.Create
pwd("html id").value = "Passwd"
Dim sg
Set sg = description.Create
sg("html id").value = "signIn"

Dim inbox
Set inbox = description.Create
inbox("innertext").value = "Inbox .*"

'Login to the application
browser(bro).page(pag).webedit(un).Set "mail id"
browser(bro).page(pag).webedit(pwd).Set "password r"
browser(bro).page(pag).webbutton(sg).Click
browser(bro).page(pag).Sync 

Dim fr
Set fr = description.Create
fr("name").value = "canvas_frame"
Dim wt
Set wt = description.Create
wt("html id").value = ":om"
tot = browser(bro).page(pag).webtable(wt).GetROProperty("rows")
For j = 1 to tot
t = browser(bro).page(pag).webtable(wt).GetCellData(j,6)
p = "C2C DealC2C"
Dim myRegExp
Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern =  (p)   
Set oMatches = myRegExp.Execute(t)
For each matches in oMatches
set  x = browser(bro).page(pag).webtable(wt).Childitem(j,2,"WebElement",0)
x.click
Next
next









Regards
Shashi...



--
Regards

Shashidhar

spmis...@gmail.com

unread,
Dec 22, 2013, 1:56:24 PM12/22/13
to mercu...@googlegroups.com
Hi Gobinda and all,
I am using it but not working
Code is below given ; plz tell me the correct answer.

systemutil.Run "iexplore.exe","http://www.nucleation.in/qtp-function-click-link-web-table/"
wait(10)
set rownum=Browser("QTP Function to Click").Page("QTP Function to Click").WebTable("Sl. No").GetRowWithCellText("Address",3,1)'add the table in OR.
set LinkObj=Browser("QTP Function to Click").Page("QTP Function to Click").WebTable("Sl. No").ChildItem(2,1, "Address",0)
LinkObj.click
Reply all
Reply to author
Forward
0 new messages