nikgoodley-ibboost / aost

Automatically exported from code.google.com/p/aost
0 stars 0 forks source link

TrUMP may generate duplicated name in the sibling nodes #95

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Right now, we use the name conversion

"T4" + (first character chain of the xpath) 

which may generate duplicated name in the sibling nodes. For example,
the google search page ui module,

Container(UID: 'root', clocator: [tag: 'table']){
    Container(UID: 'T4t', clocator: [tag: 'td']){
        InputBox(UID: 'input0', clocator: [tag: 'input', title: 'Google Search',
name: 'q'])
        SubmitButton(UID: 'input1', clocator: [tag: 'input', type: 'submit',
value: 'Google Search', name: 'btnG'], respond: ['click'])
        SubmitButton(UID: 'input2', clocator: [tag: 'input', type: 'submit',
value: 'I'm Feeling Lucky', name: 'btnI'], respond: ['click'])
    }
    Container(UID: 'T4t', clocator: [tag: 'td']){
        UrlLink(UID: 'a3', clocator: [tag: 'a', text: 'Preferences', href:
'/preferences?hl=en'])
        UrlLink(UID: 'a4', clocator: [tag: 'a', text: 'Language Tools', href:
'/language_tools?hl=en'])
        UrlLink(UID: 'a5', clocator: [tag: 'a', text: 'Advanced Search', href:
'/advanced_search?hl=en'])
    }
}

We must make sure that the node names in the siblings be unique, otherwise,
there is no way to different them by their uids.

Original issue reported on code.google.com by John.Jian.Fang@gmail.com on 4 Feb 2009 at 4:13

GoogleCodeExporter commented 9 years ago
Fixed by appending counter to the duplicated names,

Container(UID: 'root', clocator: [tag: 'table']){
    Container(UID: 'T4t', clocator: [tag: 'td']){
        InputBox(UID: 'input0', clocator: [tag: 'input', title: 'Google Search', name: 'q'])
        SubmitButton(UID: 'input1', clocator: [tag: 'input', type: 'submit', value: 'Google
Search', name: 'btnG'], respond: ['click'])
        SubmitButton(UID: 'input2', clocator: [tag: 'input', type: 'submit', value: 'I'm
Feeling Lucky', name: 'btnI'], respond: ['click'])
    }
    Container(UID: 'T4t2', clocator: [tag: 'td']){
        UrlLink(UID: 'a3', clocator: [tag: 'a', text: 'Advanced Search', href:
'/advanced_search?hl=en'])
        UrlLink(UID: 'a4', clocator: [tag: 'a', text: 'Preferences', href:
'/preferences?hl=en'])
        UrlLink(UID: 'a5', clocator: [tag: 'a', text: 'Language Tools', href:
'/language_tools?hl=en'])
    }
}

Original comment by John.Jian.Fang@gmail.com on 4 Feb 2009 at 5:11