How to check for existence of the Object .?
Hello Everyone,
Currently, I am performing a test where I need to check for the existence of the object .......depending on that I need to return the value.
One of the functions in the test case is ...
function Devicespace()
{
if(!Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("DockContainer", "", 1).WinFormsObject("Devices").Exists)
{
return Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("DockContainer", "",2).WinFormsObject("Devices").WinFormsObject("Devices").WinFormsObject("_treeTableView").WinFormsObject("InternalListView", "");
}
if(!Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("DockContainer", "", 2).WinFormsObject("Devices").Exists)
{
return Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("DockContainer", "",1).WinFormsObject("Devices").WinFormsObject("Devices").WinFormsObject("_treeTableView").WinFormsObject("InternalListView", "");
}
}
Brief description about the code ..
I am trying to check for the existence of WinFormsObject("Devices") as per the examples provided on the website it should work, but when i try the same on my application....it tries to search for that particular object and the test failes if it doesnt find that object .....stating that "Unable to find the WinFormsObject(Devices)" for the reference refer the image below.
Please guide me through..Thank you.
Hi iamraj09,
You need to use the WaitWinFormsObjects to obtain the object you need to check:
if(!Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("DockContainer", "", 1).WaitWinFormsObject("Devices", 5000).Exists)