How to click on element with same name ?

Class library usage, coding and language questions.
BR_05
Posts: 11
Joined: Thu Apr 05, 2007 8:04 am
Location: Switzerland

How to click on element with same name ?

Post by BR_05 » Thu Sep 13, 2007 5:36 pm

I have an GUI (based on javascript) I'm able to click on element with the element name parameter.

And with this GUI, I have several element with the same element name. Is it possible to click on one chosen element by Index or something like that ?

How can I do to specify the element to click ?

Thanks in advance

BR

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Fri Sep 14, 2007 5:07 pm

You can read all elements with the same role and name as follows:

Code: Select all

element=Ranorex.ControlGetElement(form)
itemCount = Ranorex.ElementFindChildren(element, Ranorex.ROLE_..., 'Name')

for index in range(0,itemCount):
    child= Ranorex.ElementGetChildFieldItem(index)
    if child == None:
        print 'Cannot read child' + str(index)
        continue;
    print '      child item =' + child[2]
Jenö
Ranorex Team