[LDTP-Dev] Simple python script is not working

Mauricio Lin mauriciolin at gmail.com
Fri Oct 21 08:55:49 PDT 2005


Hi Shaheed,

I solved the problem.

I put a time.sleep() between the two actions as below:

selectmenuitem ('frmUnsavedDocument1-gedit', 'mnuFile;mnuOpen')
time.sleep(2)
click('dlgOpenFile', 'btnCancel')

It was a kind of sync problem.

BR,

Mauricio Lin.

On 10/21/05, Mauricio Lin <mauriciolin at gmail.com> wrote:
>
> I also removed the "..." dots from [dlgOpenFile...], but the error keeps
> happening.
>
> On 10/21/05, Mauricio Lin < mauriciolin at gmail.com> wrote:
> >
> > Hi Shaheed,
> >
> > The selectmenuitem is working now. Thanks.
> >
> > I have followed the new "How to write test scripts in python" and
> > another similar error is happening. See below:
> >
> > Traceback (most recent call last):
> > File "simple.py", line 13, in ?
> > click('dlgOpenFile', 'btnCancel')
> > ldtp.error: Unable to get gui handle ldtp.c 494
> >
> > The gedit.map that show the dlgOpenFile is:
> > [dlgOpenFile...]
> > dlgOpenFile={class=dialog,parent=gedit,child_index=1,label=Open File...}
> > flr0={class=filler,parent=dlgOpenFile,child_index=0}
> > ...
> > btnOpen={class=push_button,parent=flr13,child_index=0,label=Open}
> > btnCancel={class=push_button,parent=flr13,child_index=1,label=Cancel}
> >
> > The script is:
> >
> > initappmap('/home/mauricio/teste/gedit.map')
> >
> > launchapp('gedit')
> >
> > selectmenuitem ('frmUnsavedDocument1-gedit', 'mnuFile;mnuOpen')
> >
> > guiexist ('dlgOpenFile')
> >
> > click('dlgOpenFile', 'btnCancel')
> >
> > BR,
> >
> > Mauricio Lin.
> >
> > On 10/21/05, Shaheed Shaik <sshaik at novell.com > wrote:
> > >
> > > Hi Mauricio,
> > >
> > > Check whether the window name you passed to 'selectmenuitem' or
> > > 'click'
> > > is matching with the one in your 'gedit.map', if you are using latest
> > > appmap module, it would have been generated as
> > > 'frmUnsavedDocument1-gedit'. If that is the case, your selectmenuitem
> > > should be as follows,
> > > selectmenuitem ('frmUnsavedDocument1-gedit', 'mnuFile;mnuOpen').
> > >
> > > Also cross check whether the accessibility is enabled or not.
> > >
> > > Cheers,
> > > Shaheed.
> > >
> > > >>> Mauricio Lin < mauriciolin at gmail.com> 10/20/05 8:37 pm >>>
> > > Hi all,
> > >
> > > I have followed the instruction from
> > >
> > > http://gnomebangalore.org/ldtp/index.php/How_to_create_Test_Scripts_for_PY-
> > > LDTPin
> > > order to create my simple script, but it is not working.
> > >
> > > The error message is printed as follow:
> > >
> > > Traceback (most recent call last):
> > > File "teste.py", line 9, in ?
> > > selectmenuitem ('gedit', 'mnuFile;mnuOpen')
> > > ldtp.error: Unable to get gui handle ldtp.c 1236
> > >
> > > This happens after I execute the python script.
> > >
> > > **************************************************************
> > > from ldtp import *
> > > from ldtputils import *
> > > import sys, string
> > >
> > > initappmap('/home/mauricio/teste/gedit.map')
> > >
> > > launchapp('gedit')
> > >
> > > selectmenuitem ('gedit', 'mnuFile;mnuOpen')
> > >
> > > click ('gedit', 'btnOpen')
> > > **************************************************************
> > >
> > > Any idea?
> > >
> > > BR,
> > >
> > > Mauricio Lin.
> > >
> > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/ldtp-dev/attachments/20051021/48b3c07a/attachment.html


More information about the Ldtp-dev mailing list