Object Recognition of a Message Box is failing

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
kdreiling
Posts: 34
Joined: Mon Sep 24, 2012 9:45 pm
Location: Kansas City

Object Recognition of a Message Box is failing

Post by kdreiling » Thu Dec 10, 2020 9:22 pm

I am working on an older legacy forms app that the test suite has not been worked on in quite a while. Since that time, a form that used to pop up that allowed the user to select Yes - I want to log in or No - I don't want to log in has been converted to a message box. So when I open the application, the app actually starts up, but is hidden and the Message Box displays until Yes/No button is selected. The problem is that Ranorex does not recognize that message box. I am currently on 9.3.2 and about to upgrade to 9.3.4, but does anyone has any idea of a possible solution? Here is the code that is being called. Do I need to create some custom user code to click return on button1? Any suggestions are welcome.

iAnswer = System.Convert.ToInt16(MessageBox.Show("You are logging into a test Database! Are you sure you want to do this?", "Test Database!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly));

if (iAnswer == (int)VB.MsgBoxResult.No)
{
// We end the program as this will take a config file edit to fix:
Application.Exit();
ProjectData.EndApp();
}

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: Object Recognition of a Message Box is failing

Post by Stub » Fri Dec 11, 2020 12:32 pm

You're probably going to need to update your Rx repository to reflect the UI changes in your app, from a Form to a MessageBox. I'd compare and contrast the old and new versions in RxSpy to figure out the differences in addressing that are required.