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

There are multiple buttons on a web page with the same name - "Edit". I have tried to use Descriptive Programming/Index property to click on the WebButton with a certain Index. However, the script clicks on a button with the Index=0.
Please find the screenshots with explanation and advise me on the code to provided in the script.

Thanks,
Shilpa R.


Attached Files
.doc   Edit Button- Index.doc (Size: 57.5 KB / Downloads: 165)
Reply
#2
Not Solved
Are you using descriptive programming or object repository? I hope the edit button might be added under first container that the reason why it's hitting the first button always. Check the hierarchy in your script or object repo.
if you need any further help please post the pseudo-code and object spy screenshots of the 2 edit bottons.
Thanks,
SUpputuri
Reply
#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: 123)
Reply


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,993 02-12-2015, 04:00 PM
Last Post: Kirill
  Unable to click on WebButton in WebTable srach84 1 3,094 02-09-2015, 09:07 PM
Last Post: arpan
  Unable to click on moving text in a website Akhila 4 3,999 07-18-2013, 02:38 PM
Last Post: tanyamrz
  QTP recognizing every JavaEdit as "VTextField" having different index values. K Gaurav Varshney 1 2,390 10-29-2012, 11:51 AM
Last Post: krr
  unable to click webelement by holding shift key tanyamrz 1 3,504 09-14-2012, 05:21 AM
Last Post: kcn

Forum Jump:


Users browsing this thread: 1 Guest(s)