Popup Watcher Not Executing Callback

Class library usage, coding and language questions.
chromium
Posts: 3
Joined: Tue Dec 23, 2014 4:01 pm

Popup Watcher Not Executing Callback

Post by chromium » Thu Jan 15, 2015 5:07 pm

I am trying to test a popup watcher that takes a screenshot and fails the test case if an error message pops up, which could occur randomly at any time. I am having issues with getting it to work, however. When running it I get an exception from Ranorex and the test completes as a Success. This is my code:

Code: Select all

	Dim mypopupwatcher As New PopupWatcher()
	mypopupwatcher.Watch(repo.ErrorMessage.SelfInfo, AddressOf geterrortxt)
	mypopupwatcher.Start()


	Public Sub geterrortxt()
		Dim errormessagetxt As String

		If repo.ErrorMessage.SelfInfo.Exists() Then
			errormessagetxt = repo.ErrorMessage.MessageTxt.TextValue
			Report.Screenshot(repo.ErrorMessage.Self)
			Report.Log(ReportLevel.Failure,errormessagetxt)
		End If
			
	End Sub
What could be causing this issue?
Attachments
exception.png
exception.png (27.43 KiB) Viewed 924 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Popup Watcher Not Executing Callback

Post by Support Team » Fri Jan 16, 2015 10:41 am

Hello chromium,

Unfortunately, it is not possible to stop or fail the current test run using the PopupWatcher since the watcher doesn’t run in the main thread. The “System.ArgumentOutOfRangeException” seems not to be directly related to your PopupWatcher.

Regards,
Robert
.
Image