Hi Andre,<br><br><div class="gmail_quote">On Thu, Jan 12, 2012 at 1:05 PM, Andre Klapper <span dir="ltr"><<a href="mailto:ak-47@gmx.net">ak-47@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Nags,<br>
<br>
as usual thanks for your answer & your patience with me. :)<br>
<div class="im"><br>
On Fri, 2012-01-06 at 18:00 -0800, Nagappan Alagappan wrote:<br>
> How to get the object index:<br>
> getobjectproperty('window name', 'object name', 'obj_index')<br>
> example:<br>
> getobjectproperty('*gedit', 'mnuQuit', 'obj_index')<br>
<br>
</div>Wonderful, this makes it language-independent and reusable!<br>
<div class="im"><br>
> Use variable name in the script and import appropriate locale file<br>
> which has same variable name mapping with respective locale string.<br>
> example:<br>
> gedit_cs_CZ.py will have the following entries:<br>
> mnuFile = mnuSoubor<br>
> mnuQuit = mnuUkončit<br>
<br>
</div>If I get it right this would require parsing all the translations first<br>
that I plan to cover by extracting translations and add them into the<br>
mapping file, plus it is error-prone as translations are a moving target<br>
(work in progress), especially before a major release.<br>
<br>
That's why I'd love to access all objects by using their index in my<br>
script, however it seems that some objects simply don't have an index,<br>
as the LDTP Tutorial PDF states on page 13 ("Different ways of<br>
representing window name", item 7): "Window type and index (only if<br>
window does not have any accessible title, Ex: 'dlg0')".<br>
<br>
I get an error when I try to get the index of the "gedit Preferences"<br>
dialog when going to Edit > Preferences with this code:<br>
<br>
# -*- coding: utf-8 -*-<br>
<div class="im">#!/usr/bin/python<br>
from ldtp import *<br>
</div>launchapp('gedit', lang = 'en_US.utf8')<br>
if waittillguiexist ('*gedit') == 0:<br>
raise LdtpExecutionError ('Application window does not exist')<br>
print "Application window exists."<br>
selectmenuitem ('*gedit', 'mnu#32')<br>
if waittillguiexist ('dlggeditPreferences') == 0:<br>
raise LdtpExecutionError ('Dialog window does not exist')<br>
time.sleep (3)<br>
OBJECTINDEX = getobjectproperty('*gedit', 'dlggeditPreferences', 'obj_index')<br>
print "obj_index for dlggeditPreferences is: "<br>
print OBJECTINDEX<br>
<br>
The error is:<br>
<div class="im"><br>
Traceback (most recent call last):<br>
</div> File "index.py", line 12, in <module><br>
OBJECTINDEX = getobjectproperty('*gedit', 'dlggeditPreferences', 'obj_index')<br>
<div class="im"> File "/usr/lib/python2.7/site-packages/ldtp/client.py", line 65, in __call__<br>
return self.__send(self.__name, args)<br>
File "/usr/lib/python2.7/xmlrpclib.py", line 1575, in __request<br>
verbose=self.__verbose<br>
File "/usr/lib/python2.7/site-packages/ldtp/client.py", line 180, in request<br>
raise LdtpExecutionError(e.faultString.encode('utf-8'))<br>
</div>ldtp.client_exception.LdtpExecutionError: Unknown property "obj_index" in dlggeditPreferences<br>
<br>
So I guess there is no way to make my script completely avoid using any<br>
language-dependent object names and only indexes? Sigh. :-/<br></blockquote><div><br></div><div>As of now, we don't have option for obj_index for all the windows. I mean, you can access:</div><div><br></div><div>getobjectproperty('dlggeditPreferences', 'dlggeditPreferences', 'obj_index')</div>
<div><br></div><div>but the result will be just based on the current window. Maybe will try to implement it based on the current application.</div><div><br></div><div>Thanks</div><div>Nagappan </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
andre<br>
--<br>
mailto:<a href="mailto:ak-47@gmx.net">ak-47@gmx.net</a> | failed<br>
<a href="http://blogs.gnome.org/aklapper" target="_blank">http://blogs.gnome.org/aklapper</a><br>
<br>
_______________________________________________<br>
LDTP-dev mailing list<br>
<a href="mailto:LDTP-dev@lists.freedesktop.org">LDTP-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/ldtp-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/ldtp-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Linux Desktop (GUI Application) Testing Project - <a href="http://ldtp.freedesktop.org">http://ldtp.freedesktop.org</a><br><a href="http://nagappanal.blogspot.com">http://nagappanal.blogspot.com</a><br>