GNOME Bugzilla – Bug 547572
Components should be exposed in a hierarchical way
Last modified: 2010-04-14 10:54:07 UTC
Please describe the problem: The way objects are arranged in the AT-SPI layer is very hierarchical. It makes little sense that only context objects have a getchild method. It would be very useful if component also had this method. It will improve a lot the way objects can be recognized. In example, if there are two text field without name (txt0 and txt1), and one is a child of a tab page that do have a name, the hierarchy can be used to select the correct text field. This can be workaround using getobjectproperty(context, component, 'children'), but having getchild method will improve a lot the OO structure of the script and will allow to search the child by role. Steps to reproduce: This is an improvement Actual results: Expected results: Does this happen every time? Other information:
Any updates on this bug?
Created attachment 128134 [details] [review] Proposed patch Ara, Could you please verify this for me :)
Ara: the above patch doesn't work. I thought its a simple work, but actually its not. Let me target this for LDTP 1.6.
Thanks for the bug report. Fixed in git.
I had expected to have something more clear in ooldtp. For ldtp.py the solution seems nice, but for ooldtp is more OO to have a getchild method in the component object, to be able to do something like: button_close = frm1.getchild('Close') Right now getchild is only available for contexts (in ooldtp)
in ooldtp.py Maybe moving getchild back to component and removing parent argument, something like: def getchild (self, name = '', role = ''): if name == '' and role == '': raise ldtp.LdtpExecutionError ('Atleast one argument should be provided <object name> or <role name>') if role != '' childList = ldtp.getchild (self.__window, name, role, self.__name) componentList = [] for i in childList: componentList.append (component (self.__window, i, role, self.__name)) return componentList else: return component (self.__window, name) Parent would always be self.__name
Created attachment 132809 [details] [review] Proposed patch for ooldtp This is a patch for ooldtp. getchild moved from context to component Added component name same as window for contexts Fixes a bug when getting children by role (one more argument to component was given)
Have you had the time to review the patch? Thanks, Ara.
(In reply to comment #8) > Have you had the time to review the patch? Uploaded your patch to git. Thanks for the patch :) Thanks
Regression in LDTP2 getchild is, again, only available for Context
Created attachment 158015 [details] [review] Proposed patch to fix the issue Ara, request to verify this, also request to add a test for me to verify this issue. Thanks
Review of attachment 158015 [details] [review]: Hello Nagappan, The fix does not work. Now, when using getchild for a Context, I get a list of strings, rather than a list of Components Ideally this is how it would work: Open gedit with an unsaved documents gedit = ooldtp.context('frm*gedit') unsaved = gedit.getchild('ptabUnsavedDocument1') That would return a Component for the tab and you could do: unsaved.getchild("txt0") to get the list of children (also, as a component) but, currently, you get a string, which does not solves the problem
Thanks Ara for verifying the fix