LDTP  3.5.0
 All Pages
waittillguinotexist

Syntax

waittillguinotexist('<window name>'[, '<component name>'[, guiTimeOut][, <'state'>]])

Description

If the given window name does not exist, this function returns

  1. If window exist, then this function returns 0. Difference between guiexist and waitguinotexist is, waitguinotexist waits for maximum 30 seconds. Still the window does not disappear, then 0 is returned. We can set the environment variable 'GUI_TIMEOUT' to change the default waiting time. We can wait for component also and its an optional argument. The default value of guiTimeOut is None and it can be changed either by environment variable or by passing an integer argument > 0. This timeout will be for this specific window and it will not affect the global default time out settings. If you want to change the global default time out settings use guitimeout or objtimeout function appropriately.

Different window types

  1. Frame(frm)
  1. Dialog(dlg)
  1. Alert(dlg)
  1. Font Chooser(dlg)
  1. File Chooser(dlg)
  1. Window(This type in general does not have any associated title, so we need to represent them using index - dlg)

Glob Pattern support

Window name can be clubbed with glob patterns(* or ?)

Different ways of representing window name

  1. Window type and window title(Ex: 'frmUnsavedDocument1-gedit')
  1. Window title(Ex: 'Unsaved Document 1 - gedit')
  1. Window type, glob expression and partial window title(Ex: 'frm*-gedit')
  1. Glob pattern and partial window title(Ex: '*-gedit')
  1. Window type, partial window title and glob pattern(Ex: 'frmUnsavedDocument1*')
  1. Window type, window title and index(If two windows of same title exist at same time. Ex: First window name 'dlgAppoinment', Second window name 'dlgAppoinment1')
  1. Window type and index(only if window does not have any accessible title, Ex: 'dlg0')

Window name formats

If window label contains space or new line characters, they will be stripped.

Example

  1. 'Unsaved Document 1 – gedit', will be represented as 'UnsavedDocument1-gedit'
  1. 'Unsaved Document 1

    gedit', will be represented as 'UnsavedDocument1gedit'

Refer:

Linux: http://cgit.freedesktop.org/ldtp/ldtp2/tree/ldtpd/core.py

Mac: https://github.com/ldtp/pyatom/blob/master/atomac/ldtpd/core.py

Windows: https://github.com/ldtp/cobra/blob/master/Ldtpd/.cs

Return values
1on success, 0 otherwise

Example

from ldtp import *
launchapp('gedit')
waittillguiexist('*-gedit')
settextvalue('*-gedit', 'txt1', 'test')
# Wait for Undo button state enabled
waittillguiexist('*-gedit', 'btnUndo', state = state.ENABLED)
click('*-gedit', 'btnUndo')
# Wait for Redo button state enabled
waittillguiexist('*-gedit', 'btnRedo', state = state.ENABLED)
# Quit gedit application
selectmenuitem('*-gedit', 'mnuFile;mnuQuit')
# Wait for Gedit window to close
waittillguinotexist('*-gedit')

This function will be useful, when some event is fired and after that if an existing window should close, we can use this function to wait till the window closes.

Author
Nagappan Alagappan nagap.nosp@m.pan@.nosp@m.gmail.nosp@m..com


Linux Desktop Testing Project