03-31-2015, 04:36 AM
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
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
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