Object not found when exe called from other code.

Ranorex Studio, Spy, Recorder, and Driver.
Posts: 8
Joined: Wed May 20, 2015 9:13 pm

Object not found when exe called from other code.

Post by kewpiedoll99 » Wed Jul 01, 2015 9:15 pm

I have a short automated Ranorex test that goes to a Chrome window and changes the widths of some table columns, clicks an icon, fills in a form, and so on. My process is to do most of the setup using Java code, and then call this exe to execute a portion of the test. The Java code opens the Chrome browser and carries out various actions before calling the exe.

I have copied the Ranorex .exe and .rxtst files from the bin/Debug directory into a directory inside the Java directory structure (for access by the Java code). It's not feasible for me to change to the bin/Debug directory before calling the exe, so I am confused about how to get this to work.

When I test the exe by itself from the command line, it executes fine. When I call it from the Java app, it returns a nonzero value indicating failure:
Object reference not set to an instance of an object.
at CloneInstHtmlPage.Recording1.WidenPublishCloneColumn() at CloneInstHtmlPage.Recording1.Ranorex.Core.Testing.ITestModule.Run() at Ranorex.Core.Testing.TestSuiteModule.RunInternal(DataContext parentDataContext)
Here is the result of some experiments:

Code: Select all

When I execute from the command line and a Chrome browser window is open, 
    if I run the exe from the {projectname}/bin/Debug directory, 
        the exe executes its commands in the existing Chrome browser window.

    else if I run the exe from another dir by providing the full path to the exe,
        the exe generates the error above.

    else if I run a copy of the exe (copied from the Debug dir to another dir),
        the exe generates the error above.
I'm frankly not clear on how the exe "knows" to look in Chrome, since I do not open up a Chrome browser as part of the Ranorex test. If a Chrome window is not already open, no matter how/from which dir I run the exe, it generates the error above.

In case it is relevant, here is the method in question:

Code: Select all

private void WidenPublishCloneColumn() {
     // change width of header cells
     string hdrTdRxPathBase = "/dom/body/div[@id='main-3343801']/div/div[2]/div/div[2]" +
         "/div/div/div/div[2]/div/div/div[3]/div/div/div/div[2]/div/div[2]/div/div/div[3]" +
     TdTag hdrTd = null;
     string hdrTdRxPath = hdrTdRxPathBase + "[" + 9 + "]";

     Host.Local.TryFindSingle(hdrTdRxPath, 1000, out hdrTd);
     DivTag innerHdrDiv = null;
     Host.Local.TryFindSingle(hdrTdRxPath + "/div[3]", 1000, out innerHdrDiv);
LMK if any other information from my project is required. Thanks in advance for your help.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Object not found when exe called from other code.

Post by Support Team » Fri Jul 03, 2015 2:00 pm

Hi kewpiedoll99,

In order to analyze this issue in more detail I'd need additional information.
Therefore, may I ask you to answer the following questions?
  • Which version of Ranorex are you using?
  • Which Operating System is installed on your system?
  • Is your java application started as Administrator?
  • Is it possible for your to provide a short sample whereby this problem occurs?
This should help us analyzing and reproducing the issue on our side. Thank you in advance.

PS: If you don't want to post the application and the information in this public forum, you can also send an email to [email protected]

Markus (S)

Posts: 8
Joined: Wed May 20, 2015 9:13 pm

Re: Object not found when exe called from other code.

Post by kewpiedoll99 » Tue Jul 14, 2015 9:31 pm

I sent a reply to the email address, including a zip of my project. Thank you!