After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668514 - Provide obj_index for all windows
Provide obj_index for all windows
Status: VERIFIED FIXED
Product: LDTP
Classification: Other
Component: general
2.2
Other Linux
: Normal enhancement
: ---
Assigned To: LDTP maintainers
LDTP Development Mailing List
Depends on:
Blocks:
 
 
Reported: 2012-01-23 16:25 UTC by André Klapper
Modified: 2012-02-19 11:16 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description André Klapper 2012-01-23 16:25:28 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):
  • File "index.py", line 12 in <module>
    OBJECTINDEX = getobjectproperty('*gedit', 'dlggeditPreferences', 'obj_index')
  • File "/usr/lib/python2.7/site-packages/ldtp/client.py", line 65 in __call__
    return self.__send(self.__name, args)
  • File "/usr/lib/python2.7/xmlrpclib.py", line 1575 in __request
    verbose=self.__verbose
  • File "/usr/lib/python2.7/site-packages/ldtp/client.py", line 180 in request
    raise LdtpExecutionError(e.faultString.encode('utf-8'))
ldtp.client_exception.LdtpExecutionError: Unknown property "obj_index" in dlggeditPreferences


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."
Comment 1 André Klapper 2012-02-18 14:31:31 UTC
Any guestimation how complicated this would be to implement?
Comment 2 Nagappan Alagappan 2012-02-18 21:39:29 UTC
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
Comment 3 André Klapper 2012-02-19 11:16:12 UTC
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!