Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to click on the WebButton with specified Index
#3
Not Solved
Hi,

I have used descriptive programming to click on the Edit button as below, however, it still selects the first Edit button instead of the Index
Code:
Descriptive Programming Code –
Set oLink=Description.Create()
oLink("micclass").value="WebButton"
oLink("html tag").value="INPUT"
oLink("type").value="submit"
oLink("class").value=" linkbtn_"
oLink("value").value="Edit"
                            
Set LinkCount=Browser("AUS Online Banking - Batch").Page("AUS Online Banking - Batch").ChildObjects(oLink)
        
For n=0 to LinkCount.Count-1
                                                LinkTitle=LinkCount(n).GetROProperty("value")
                                                    msgbox LinkTitle
                                                    If LinkTitle="Edit" Then
                                                        LinkCount(n).WebButton("name:=Edit.*","Index:=j+1").Click
                                                       Exit For
                                                    End If
Next

Code to select the Edit button based on the Index provided in the Object repository

Set oDesc=Description.Create()
oDesc("micclass").value="WebButton"
oDesc("html tag").value="INPUT"
oDesc("class").value="linkbtn_ flblinkbtn_"

Set ButtonCount=Browser("AUS Online Banking").Page("AUS Online Banking - Batch").ChildObjects(oDesc)
'msgbox ButtonCount.Count
For j=0 to ButtonCount.Count-1
'msgbox j
ButtonTitle=ButtonCount(j).GetROProperty("value")
'msgbox ButtonTitle
If ButtonTitle=DataTable("BatchDebitTempDesc","Global") Then
ButtonCount(j).Click
'Browser("AUS Online Banking").Page("AUS Online Banking - Batch").WebButton("name:=Edit","Index:=&j+1").Highlight
Browser("AUS Online Banking").Page("AUS Online Banking - Batch").WebButton("Edit_"&j+1).Click
Exit For
End If
Next

On the other side, I have added the same Edit object with different Indexes in the Object Repository named as Edit_1, Edit_2, etc. and provided the code as below. The Edit button is clicked based on the position of the Index. However, this might not work if there are large number of Webbuttons with the same name as it is a tedious process to add the same object with different name in the Object Repository.

Please find the attachment on the code and snaphots of the Object repository and the Object properties from Object Spy.

Thanks,
Shilpa


Attached Files
.doc   Edit button - Object Spy.doc (Size: 255 KB / Downloads: 111)
Reply


Messages In This Thread
RE: Unable to click on the WebButton with specified Index - by srach84 - 03-31-2015, 04:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP is not identifying table with column names property but its identifing with index Anuradha B 1 2,849 02-12-2015, 04:00 PM
Last Post: Kirill
  Unable to click on WebButton in WebTable srach84 1 2,907 02-09-2015, 09:07 PM
Last Post: arpan
  Unable to click on moving text in a website Akhila 4 3,806 07-18-2013, 02:38 PM
Last Post: tanyamrz
  QTP recognizing every JavaEdit as "VTextField" having different index values. K Gaurav Varshney 1 2,215 10-29-2012, 11:51 AM
Last Post: krr
  unable to click webelement by holding shift key tanyamrz 1 3,363 09-14-2012, 05:21 AM
Last Post: kcn

Forum Jump:


Users browsing this thread: 1 Guest(s)