GNOME Bugzilla – Bug 668514
Provide obj_index for all windows
Last modified: 2012-02-19 11:16:12 UTC
Filing this report as per mailing list postings, so this does not get forgotten. I would like to access ALL objects in a script by using the objects' indexes. It seems that some objects simply don't have an index, as the LDTP Tutorial PDF states on page 13 ("Different ways of representing window name", item 7): "Window type and index (only if window does not have any accessible title, Ex: 'dlg0')". For example, I get an error when I try to get the index of the "gedit Preferences" dialog when going to Edit > Preferences with this code. # -*- coding: utf-8 -*- #!/usr/bin/python from ldtp import * launchapp('gedit', lang = 'en_US.utf8') if waittillguiexist ('*gedit') == 0: raise LdtpExecutionError ('Application window does not exist') print "Application window exists." selectmenuitem ('*gedit', 'mnu#32') if waittillguiexist ('dlggeditPreferences') == 0: raise LdtpExecutionError ('Dialog window does not exist') time.sleep (3) OBJECTINDEX = getobjectproperty('*gedit', 'dlggeditPreferences', 'obj_index') print "obj_index for dlggeditPreferences is: " print OBJECTINDEX The error is: Traceback (most recent call last):
+ Trace 229498
OBJECTINDEX = getobjectproperty('*gedit', 'dlggeditPreferences', 'obj_index')
return self.__send(self.__name, args)
verbose=self.__verbose
raise LdtpExecutionError(e.faultString.encode('utf-8'))
Nag's answer on the mailing list was: "As of now, we don't have option for obj_index for all the windows. I mean, you can access: getobjectproperty('dlggeditPreferences', 'dlggeditPreferences', 'obj_index') but the result will be just based on the current window. Maybe will try to implement it based on the current application."
Any guestimation how complicated this would be to implement?
Andre, can you please verify with git head ? launchapp('gedit') waittillguiexist('gedit#0') click('gedit#0', 'btn#1') # btnOpen waittillguiexist('gedit#1') # Open dialog click('gedit#1', 'btn#6') # btnCancel waittillguinotexist('gedit#1') selectmenuitem('gedit#0', 'mnu#9') # mnuQuit waittillguinotexist('gedit#0') and see this is what you expect ? I have verified this on Fedora 16. Thanks
Tested with 2.3.0 on Fedora16 and the patch manually applied. The gedit Preferences dialog gets the gedit#2 index ID and did not have an index ID before. Awesome! Thanks so much!