Popup Watcher setup

Class library usage, coding and language questions.
bwood
Posts: 16
Joined: Mon Jan 28, 2019 2:52 pm

Popup Watcher setup

Post by bwood » Mon Jan 28, 2019 4:17 pm

Hello,

I am having issues setting up a Popup watcher. I am on Windows 10 Enterprise and Ranorex 8.3.2.

I get several errors saying Popup Watcher does not contain definitions for what I am trying to do (see screenshot)

I'm not sure what I am doing wrong as I have modified code from https://github.com/ranorex/Packages/blo ... Library.cs and pop-up-handler-watcher-t9521.html

/*
 * Created by Ranorex
 * User: WoodB
 * Date: 1/11/2019
 * Time: 3:43 PM
 * 
 * To change this template use Tools > Options > Coding > Edit standard headers.
 */
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;
using Ranorex.Core.Repository;

namespace Smoke_Tests_Development
{
    /// <summary>
    /// Description of StartPopupWatcher.
    /// </summary>
    [TestModule("8EA0B730-85F2-42EB-985E-8CA5BC82CD5F", ModuleType.UserCode, 1)]
    public class StartPopupWatcher : ITestModule
    {
    	public static Smoke_Tests_Development.Smoke_Tests_DevelopmentRepository repo = Smoke_Tests_Development.Smoke_Tests_DevelopmentRepository.Instance;
        /// <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;
            
            PopupWatcher myPopupWatcher = new PopupWatcher();
            
            myPopupWatcher.WatchAndClick(repo.COM.Form1132Com.WarningInfo, ClickOut);
            
            myPopupWatcher.Start();
        }
        
        public static void ClickOut(Ranorex.Core.Repository.RepoItemInfo repoItemInfo, Ranorex.Core.Element repoElement){
        	
        	if (repoItemInfo == repo.COM.Form1132Com.WarningInfo){
        		repo.COM.Form1132Com.ButtonOK.Click();
        	}
        	
        }
        
        
    }
}
Attachments
errors.PNG
errors.PNG (10.28 KiB) Viewed 611 times
testsnap.rxsnp
(78.18 KiB) Downloaded 9 times

User avatar
Vega
Posts: 161
Joined: Mon Jul 11, 2016 2:15 pm

Re: Popup Watcher setup

Post by Vega » Mon Jan 28, 2019 8:58 pm

I think you may be confused on how to take advantage of the automation helpers. Give this a read and let us know if you get stuck:
The popup watcher feature of the automation helpers can be used like so once you add the automation helpers:

Add new action --> User Code --> Select from Library

You should see a list of all the methods that come with the automation helpers including the PopupWatcherLibrary.

Hope this helps

bwood
Posts: 16
Joined: Mon Jan 28, 2019 2:52 pm

Re: Popup Watcher setup

Post by bwood » Wed Jan 30, 2019 8:11 pm

Thanks - the webinar link cleared things up and was very helpful.