EmonsLucas
2 years agoNew Contributor
check if object .exists Error
Hello everyone,
I have the problem in my code, that when I want to check if my object exist to continue, he stops and give me this error log:
"Unable to find the following object when executing the WPFObject command:" "NameMapping.Sys.Logit_Dilos_WpfShell.HwndSource_Root.Root.ExternalApplicationTabs.pnl"
function LagerTestOpen(){
var TimeoutValue, startTime, HauptModul, ModulButton, ModulPanel;
startTime = new Date();
TimeoutValue = Options.Run.Timeout;
ModulPanel = NameMapping.Sys.Logit_Dilos_WpfShell.HwndSource_Root.Root.ExternalApplicationTabs.pnl.WaitWPFObject("TextBlock", "Lager", 1);
Funktionen.check_dilos_open();
if (ModulPanel.Exists) {
Log.Message("Das Modul Lager ist bereits geöffnet!");
} else {
HauptModul = Aliases.Logit_Dilos_WpfShell.HwndSource_Root.Root.menuItems.WPFObject("ListBoxItem", "", 1).WPFObject("StackPanel", "", 1).WPFObject("TextBlock", "Stammdaten", 1);
HauptModul.Click();
ModulButton = Aliases.Logit_Dilos_WpfShell.HwndSource_Root.Root.subMenuDataTree.WPFObject("XamDataTreeNodeControl", "", 5).WPFObject("StackPanel", "", 1).WPFObject("Button", "Lager", 1);
ModulButton.Click();
ModulPanel = NameMapping.Sys.Logit_Dilos_WpfShell.HwndSource_Root.Root.ExternalApplicationTabs.pnl.WaitWPFObject("TextBlock", "Lager", 1);
if (ModulPanel.Exists) {
Log.Message("Das Modul Lager wurde erfolgreich geöffnet!");
} else {
Log.Error("Das Modul Lager konnte nicht geöffnet werden!"); }
}
Yes, but you are using it on
WaitWPFObject("TextBlock", "Lager", 1);
which is ClassName and WndCaption.
The error is relating to object pnl, which is what you need to check for.