I'm using LDTP to write a GUI test case script in python. I'm running the script in a virtual machine by nosetests.

And I get a block with the error of unable to find window X, while window X is absolutely displayed on the monitor. This error always occurs after LDTP actions.


After I open my subscription manager in the virtual machine (rhel6.8), I could find the subscription manager by calling getwindowlist():

>>> getwindowlist()
['frmTopExpandedEdgePanel', 'frmBottomExpandedEdgePanel', 'frmroot@localhost:~',
 'frmx-nautilus-desktop', 'frmSubscriptionManager']

Then I use getobjectlist() to do some action:

>>> getobjectlist('frmSubscriptionManager')
['flr8', 'flr4', 'mnuAbout', 'flr6', 'flr7', 'flr0', 'flr1', 'flr2', 
'flr3', 'ukn2', 'ukn3', 'ukn0', 'ukn1', 'scpn1', 'scpn0', 'scpn3', 'scpn2', 
'lblStatus1', 'lblContract', 'ptl0', 'flr5', 'txtStartEndDateText', 
'tblBundledProductsTable', 'scbr0', 'mnuRedeemSubscription', 
'tchEndDate', 'lblStatus', 'mnuSystem', 'mnuRegister', 'tchStartDate', 
'lblSKU', 'txtSKUText', 'txtProvidingSubscriptionsText', 'tchQuantity', 
'txtSupportTypeText', 'ttblMySubscriptionsView', 'mnuEmpty', 
'txtArchText', 'mnuConfigureProxy', 'txtSupportLevelAndTypeText', 
'mnuHelp', 'mnuOnlineDocumentation', 'lblStart-EndDate', 'mbr0', 

The window disappeared, even though it was still displayed on my virtual machine's monitor.

>>> getwindowlist()
['frmTopExpandedEdgePanel', 'frmBottomExpandedEdgePanel', 'frmroot@localhost:~', 'frmx-nautilus-desktop']

Why does this error occur, and how should I deal with this situation in an automated test?

2 Answers 2


There could be several reasons why LDTP is unable to find a window that is still displayed on the monitor. Here are a few possible causes:

LDTP is not able to access the window because it is being run in a different environment or context (e.g. a different user or virtual machine). The window has been minimized or is not in the foreground. The window has been closed or has crashed. There are issues with the LDTP configuration or installation. To troubleshoot this issue, you could try the following:

Make sure that LDTP is being run in the same environment and context as the window (e.g. the same user and virtual machine). Check if the window is minimized or not in the foreground, and bring it to the front if necessary. Check if the window has been closed or has crashed, and try reopening it. Check if there are any issues with the LDTP configuration or installation, and try reinstalling or reconfiguring LDTP if necessary. If none of these solutions work, you may need to look for more specific debugging information in the logs or by using a tool like strace to trace the system calls being made by LDTP.

It is possible that the window is being hidden or minimized when the LDTP actions are performed. This can cause LDTP to be unable to find the window, even though it is still displayed on the monitor.

One way to handle this situation in an automated test would be to add a delay after performing the LDTP actions, to allow the window to be displayed before attempting to access it. You can use the time.sleep() function in Python to add a delay.

Alternatively, you can try using the wait_for_window() function provided by LDTP to wait for the window to be displayed before attempting to access it. This function will wait until the specified window is found or a specified timeout is reached, whichever occurs first.

For example:

ldtp.wait_for_window('frmSubscriptionManager', 10)

This will wait up to 10 seconds for the 'frmSubscriptionManager' window to be displayed before continuing with the test.

It is also possible that the error is occurring due to a bug in LDTP or a problem with the virtual machine. In this case, you may need to try using a different tool or testing on a different machine to see if the issue persists.


To resolve the issue of LDTP not finding a window even though it's displayed on the monitor in an automated test:

Add wait mechanisms to ensure the window is fully loaded before interacting with it. Ensure the window has focus using setfocus() before performing actions. Use stable and unique identifiers to locate the window. Verify that LDTP is compatible with your virtual machine and application. Implement error handling to capture and handle such errors in your script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.