Hi Andre,<br><br><div class="gmail_quote">On Thu, Jan 12, 2012 at 1:05 PM, Andre Klapper <span dir="ltr">&lt;<a href="mailto:ak-47@gmx.net">ak-47@gmx.net</a>&gt;</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 &amp; your patience with me. :)<br>
<div class="im"><br>
On Fri, 2012-01-06 at 18:00 -0800, Nagappan Alagappan wrote:<br>
&gt; How to get the object index:<br>
&gt; getobjectproperty(&#39;window name&#39;, &#39;object name&#39;, &#39;obj_index&#39;)<br>
&gt; example:<br>
&gt; getobjectproperty(&#39;*gedit&#39;, &#39;mnuQuit&#39;, &#39;obj_index&#39;)<br>
<br>
</div>Wonderful, this makes it language-independent and reusable!<br>
<div class="im"><br>
&gt; Use variable name in the script and import appropriate locale file<br>
&gt; which has same variable name mapping with respective locale string.<br>
&gt; example:<br>
&gt; gedit_cs_CZ.py will have the following entries:<br>
&gt; mnuFile = mnuSoubor<br>
&gt; 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&#39;s why I&#39;d love to access all objects by using their index in my<br>
script, however it seems that some objects simply don&#39;t have an index,<br>
as the LDTP Tutorial PDF states on page 13 (&quot;Different ways of<br>
representing window name&quot;, item 7): &quot;Window type and index (only if<br>
window does not have any accessible title, Ex: &#39;dlg0&#39;)&quot;.<br>
<br>
I get an error when I try to get the index of the &quot;gedit Preferences&quot;<br>
dialog when going to Edit &gt; Preferences with this code:<br>
<br>
# -*- coding: utf-8 -*-<br>
<div class="im">#!/usr/bin/python<br>
from ldtp import *<br>
</div>launchapp(&#39;gedit&#39;, lang = &#39;en_US.utf8&#39;)<br>
if waittillguiexist (&#39;*gedit&#39;) == 0:<br>
  raise LdtpExecutionError (&#39;Application window does not exist&#39;)<br>
print &quot;Application window exists.&quot;<br>
selectmenuitem (&#39;*gedit&#39;, &#39;mnu#32&#39;)<br>
if waittillguiexist (&#39;dlggeditPreferences&#39;) == 0:<br>
  raise LdtpExecutionError (&#39;Dialog window does not exist&#39;)<br>
time.sleep (3)<br>
OBJECTINDEX = getobjectproperty(&#39;*gedit&#39;, &#39;dlggeditPreferences&#39;, &#39;obj_index&#39;)<br>
print &quot;obj_index for dlggeditPreferences is: &quot;<br>
print OBJECTINDEX<br>
<br>
The error is:<br>
<div class="im"><br>
Traceback (most recent call last):<br>
</div>  File &quot;index.py&quot;, line 12, in &lt;module&gt;<br>
    OBJECTINDEX = getobjectproperty(&#39;*gedit&#39;, &#39;dlggeditPreferences&#39;, &#39;obj_index&#39;)<br>
<div class="im">  File &quot;/usr/lib/python2.7/site-packages/ldtp/client.py&quot;, line 65, in __call__<br>
    return self.__send(self.__name, args)<br>
  File &quot;/usr/lib/python2.7/xmlrpclib.py&quot;, line 1575, in __request<br>
    verbose=self.__verbose<br>
  File &quot;/usr/lib/python2.7/site-packages/ldtp/client.py&quot;, line 180, in request<br>
    raise LdtpExecutionError(e.faultString.encode(&#39;utf-8&#39;))<br>
</div>ldtp.client_exception.LdtpExecutionError: Unknown property &quot;obj_index&quot; 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&#39;t have option for obj_index for all the windows. I mean, you can access:</div><div><br></div><div>getobjectproperty(&#39;dlggeditPreferences&#39;, &#39;dlggeditPreferences&#39;, &#39;obj_index&#39;)</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>