Popup Watcher Error and warnings

Class library usage, coding and language questions.
Posts: 2
Joined: Mon Jul 29, 2019 6:39 pm

Popup Watcher Error and warnings

Post by Mr.Papou » Wed Jul 31, 2019 7:57 pm

Hello everyone, I'm a beginner with Ranorex and with coding. I've watch a webinar series "Ranorex Champions training workshop" and in that series they teach how to create a Popup watcher usercode.

I've tried it on my side and I work great on the surface, but during the execution of the test, without ever stopping, it gives this error,:
Error in popup dialog handler.
Show/Hide Stacktrace
at Ranorex.Core.FunctionExecuteWithTimeout.TryExecute[T](Func`1 func, TimeSpan timeout)
at Ranorex.Core.FunctionExecuteWithTimeout.WithTimeout[T](Func`1 func, Nullable`1 timeout)
at Ranorex.Plugin.ZombieableExtensions.WithZombieCheck[T](IZombieable self, Func`1 function, ZombieCheckOptions options)
at Ranorex.Plugin.WpfRemoteObject.GetChildren(TreeBuildConfiguration configuration, WpfRemoteObject apparentParent)
at Ranorex.Plugin.WpfChildrenRule.Execute(GlueRuleExecutionState state)
at Ranorex.Core.ElementEngine.ApplyGlueRules(Element element, GlueRuleExecutionStateImpl state, Boolean includeRemotes)
at Ranorex.Core.ElementEngine.ApplyGlueRules(Element element, Boolean includeRemotes)
at Ranorex.Core.Element.GetChildren(CacheSession session)at Ranorex.Core.Element.get_Children()
at Ranorex.Core.RxPath.collectAllChildren(Element self, LocationStep step, IList`1 list, Boolean includeSelf, Boolean quitOnFirstGoodNode)
at Ranorex.Core.RxPath.collectAxis(LocationStep step, Axis optimizedAxis, Element self, IList`1 elements, Boolean quitOnFirstGoodNode)
at Ranorex.Core.RxPath.ApplyInternal(RxPath path, Element startElement, Duration timeout, Boolean findSingle, CacheSession& usedCacheSession, PathDiagnostics& pathDiagnostics)
at Ranorex.Core.RxPath.Apply(Element startElement, Duration timeout, Boolean findSingle, CacheSession& usedCacheSession, PathDiagnostics& pathDiagnostics)
at Ranorex.Core.Element.TryFindInternal(RxPath path, Duration timeout, Boolean findSingle, IList`1& foundElements, CacheSession& usedCacheSession, Duration& elementSearchTime, Int32& iterations)
at Ranorex.Core.Repository.RepoItemInfo.FindInternal[T](Boolean findSingle, Boolean throwException, Duration effectiveTimeoutOverride)
at Ranorex.Core.Repository.RepoItemInfo.<>c__DisplayClass75_0`1.<Find>b__0()
at Ranorex.Core.Testing.Services.NoMaintenanceModeService.HandleElementNotFound[T](Func`1 action, RepoItemInfo entry)
at Ranorex.Core.Repository.RepoItemInfo.Find[T](Boolean findSingle, Boolean throwException, Duration effectiveTimeoutOverride)
at Ranorex.PopupWatcher.<>c__DisplayClass27_0.<WatchAndClick>b__0(RepoItemInfo i, Element e)
at Ranorex.PopupWatcher.FindPopups(PopupItemCallback itemCallback, PopupPathCallback pathCallback, RxPath absPath, String itemName, RepoItemInfo optionalInfo)

And keep on repeating, for all the Popup I've setup in my user, this warning:
Warn Popup Watcher Item 'Proto_Update_LaunchRepository.AnvilHub.Warnings_Errors.Process_Already_Running.Btn_Ok' could not be found.

Can you help me found what's wrong, please.
Here's my UserCode:
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Threading;
using WinForms = System.Windows.Forms;

using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Testing;

namespace Proto_Update_Launch
    /// <summary>
    /// Description of PopupWatcher.
    /// </summary>
    [TestModule("686078CB-4A41-4C3B-BBF4-8EE83609AD0F", ModuleType.UserCode, 1)]
    public class StartPopupWatcher : ITestModule
        /// <summary>
        /// Constructs a new instance.
        /// </summary>
        public StartPopupWatcher()
            // Do not delete - a parameterless constructor is required!

        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
            Mouse.DefaultMoveTime = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor = 1.0;
            var Repo = Proto_Update_LaunchRepository.Instance;
        //// Anvil is already running
        	PopupWatcher anvilRunningPopup = new PopupWatcher();
		//// Cant submit with version
			PopupWatcher cantSubmitPopup = new PopupWatcher();		
        //// Guildlib is already running
        	PopupWatcher guildlibRunningPopup = new PopupWatcher();
    	//// Fire Installer Error on install
    		PopupWatcher fireErrorPopup = new PopupWatcher();

Thank you in advance,

Posts: 255
Joined: Wed Jan 25, 2017 11:08 am

Re: Popup Watcher Error and warnings

Post by qwertzu » Fri Aug 02, 2019 12:26 pm


There exists an easier way to implement a popup watcher.
You can use the user code module form the Ranorex Automation Helpers.

1. add the automation helpers
2. In a Recording module choose "Add new action" -> "User Code" -> "select from library"
3. choose modules for starting and stopping a popupwatcher

regards, qwertzu

Posts: 2
Joined: Mon Jul 29, 2019 6:39 pm

Re: Popup Watcher Error and warnings

Post by Mr.Papou » Fri Aug 02, 2019 1:14 pm

Thanks, I know about the Automation Helpers :) , but I wanted to create my own user code in a learning process to improve myself.
The Popup Watcher I made is functionnal, but gives me those warnings and errors. I've tried to search for answers as why i got those, but since I found nothing, I've decide to ask here, see if someone can help me figure it out.