Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search

18468 Posts in 4831 Topics- by 32605 Members - Latest Member: ankit
 

AdvancedQTP forums have been nominated as a finalist in ATI’s 2nd annual automation honors awards!

We’d like to thank you for your continued support and participation, and urge you to hurry and vote.

Make you voice count! 


Pages: [1]   Go Down
Print
0 Members and 1 Guest are viewing this topic.
Author Topic: Problem in identifying the webbutton    (Read 165 times)
vijay44
User
*
Offline Offline

Posts: 18


« on: February 08, 2010, 12:51:50 AM »

Hi,
I have a problem in identifying the webbutton.

The only property that a webbutton differs from the other is outerhtml.
The outhtml of webbutton is:<INPUT onclick=doCopy(1) type=button value=c name=method>
I dont want to click the first webbutton, i want to click the other webbuttons
Iam using the following code

 Set WbEdit = Description.Create()
      WbEdit("micclass").Value = "WebButton"
      WbEdit("name").Value = "C"
'      wbEdit("index").Value=1
      Set AllWbEdit = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbEdit)
      NumberOfEdits=AllWbEdit.Count
      msgbox NumberOfEdits
      For i=0 to(NumberOfEdits)-1
        if AllWbEdit(i).GetRoproperty("outerhtml")<>".*doCopy(0).*"  then
           AllWbEdit(i).Click
          End If
          Next
It does give the count, but it does not filter.probabily my representation of outerhtml is going wrong.
i tried with index, even the index is not working.
i want to exactly represent the outerhtml, this may solve my problem.
Any help will be really appreciated.
Regards;
Vijay
Logged
Robinhang
User
*
Offline Offline

Posts: 2


« Reply #1 on: February 08, 2010, 01:26:34 AM »

It's really a problem that it cannot identify the web button.
And will you provide more info of the problem?
Logged
Alexey Rakitsky
User
*
Offline Offline

Posts: 42


« Reply #2 on: February 08, 2010, 01:31:29 AM »

I'm not sure this statement is correct:

     if AllWbEdit(i).GetRoproperty("outerhtml")<>".*doCopy(0).*"  then

You should use specially object to compare string against regular expression
Logged

Best Regards,
Alexey
Asiq Ahamed
Moderator
Sr. User
*****
Offline Offline

Posts: 498



« Reply #3 on: February 08, 2010, 02:38:38 AM »

Hi Vijay,
      Could you try this way?
Code
GeSHi (qtp):
Set WbEdit = Description.Create()

WbEdit("micclass").Value = "WebButton"

WbEdit("name").Value = "C"

Set AllWbEdit = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbEdit)

NumberOfEdits=AllWbEdit.Count

msgbox NumberOfEdits



For i=0 to(NumberOfEdits)-1



if Mid(AllWbEdit(i).GetRoproperty("outerhtml"),17,9)<>"doCopy(0)"  then

AllWbEdit(i).Click

End If



Next

 
Created by GeSHI 1.0.7.20
Logged
Pages: [1]   Go Up
Print
Jump to: