Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
JohnWashburn
Posts: 54
Joined: Wed Jan 09, 2013 7:02 pm

Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by JohnWashburn » Tue Sep 03, 2013 7:28 pm

I just up[graded to Ranroex 4.1.0.

Why is it that Ranorex SPY can find Winform controls in my winForm application but the Ranorex Studio recorder/playback cannot find the control?

An example of a RXPath with this problem as provided by Spy is:

/form[@controlname='EasyBuilderJobSizeDialog']/?/?/container[@controlname='pnlOkCancel']/?/?/container[@controlname='btnOkay']/button[@accessiblename='&OK']

The common theme for what controls Studio recorder and playback (and run time) cannot find is that path to the object includes /?/

My question is how do I get
Host.Local.Find<Ranorex.Button>(objectPath)
or
Host.Local.FindSingle<Ranorex.Button>(objectPath)
to actually find objects in my winform application if the RanorexObject path to that object includes /?/ in the path?

In the example calls above you get an empty list of button for the call to Find() and FindSingle() throws and element not found exception.

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

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by Support Team » Wed Sep 04, 2013 2:49 pm

Hello,

The question mark within the path shouldn't be a problem.
Have you verified the object path with Spy?
Please try out the short Calculator example below:
public void findButtons()
{
	Host.Local.RunApplication("C:\\Windows\\System32\\calc.exe", "", "", false);	
	var buttons = Host.Local.Find<Ranorex.Button("/form[@title='Calculator']/?/?/container[@instance='1']/button");
	Report.Info(buttons.Count.ToString());
	
	var button = Host.Local.FindSingle<Ranorex.Button("/form[@title='Calculator']/?/?/container[@instance='1']/button[@controlid='114']");
	Validate.Exists(button);			
}
Could you please post or send us ([email protected]) a Ranorex Snapshot of your application?
This would help us to analyze your issue.

Thank you in advance.

Regards,
Markus (T)

JohnWashburn
Posts: 54
Joined: Wed Jan 09, 2013 7:02 pm

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by JohnWashburn » Wed Sep 04, 2013 3:00 pm

Yes, Spy finds. Studio does not.

Yes, I can verify it with SPY.

No, none of the Studio tools can find the control.
The verifier cannot find it while you are recording.
The playback does not find it when you click the play buttON.
The runtime system (ranorex.xxx.dll) does not find the control when you call the Host.Local.Find() routines from within a C# program.

I will up load a snap shot from the spy. to see if this will help with discovering the cause of this issue.

JohnWashburn
Posts: 54
Joined: Wed Jan 09, 2013 7:02 pm

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by JohnWashburn » Wed Sep 04, 2013 3:22 pm

The calculator example above works, but, I am not sure how this helps in any way.

The problem is Spy can find, but the Studio cannot.

The Verifier from the in the recorder can find the buttons of the Calculator and the playback of the recording works without error because the Studio (upon playback) can find the buttons of the Calculator app.

Let me try the Edit Button found in the studio button to edit the path in the recording manually to see what partial paths work and don't work.

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by omayer » Wed Sep 04, 2013 5:06 pm

Hi , I am running into same issue after upgrading to 4.1,
also findsingle() doesn't work same way on previous version--

this code was working before upgrade to 4.1 ---
GenericStaticClass.EnterUniqueTextInInputTag(webdoc.FindSingle(".//input[@id='txtSubject']",10000),"Test Add Contact ");


now i do have to give the dom path to make it work

GenericStaticClass.EnterUniqueTextInInputTag(webdoc.FindSingle("/dom[@page='xxx.cfm']//input[@id='txtSubject']",10000),"Test Add Contact");
Tipu

Alena
Posts: 20
Joined: Fri Feb 22, 2013 7:50 pm

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by Alena » Wed Sep 04, 2013 8:12 pm

I also encountered this issue soon after upgrade but my case was relatively easy to fix (it's still a bug though).
When I created a Simple folder in one of Ranorex-created Repo folders and added several objects in it, Spy could always highlight these objects while Test run never found them.
When I tried to edit the path, I discovered that base url was automatically repeated twice for the objects inside Simple folder. It was something like
/dom[@domain~'*****.com']/dom[@domain~'*****.com']//body/div[1]/div/div[2]/div[@provider='email']
and I had to manually delete the duplicated piece for each object.

JohnWashburn, I hope that you'll be able to discover what's wrong after analyzing Paths in Spy.

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

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by Support Team » Thu Sep 05, 2013 12:30 pm

Hello,

@JohnWashburn:
Unfortunately, I couldn't reproduce your issue.
Could you please send us your Ranorex project and application?

@omayer:
Could you please try out the following code if it is working?
InputTag myTag = webdoc.FindSingle(".//input[@id='txtSubject']",10000);
Validate.Exists(myTag);
@Alena:
Unfortunately, I couldn't reproduce your issue.
Could you please let me know how you added your repository items to the Simple folder?
Where does /dom[@domain~'*****.com'] comes from?
Do you add your repository items within the same app folder?

Thank you in advance.

Regards,
Markus (T)

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by omayer » Thu Sep 05, 2013 4:30 pm

Element '{InputTag:'txtSubject'}' does exist.
Tipu

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by omayer » Fri Sep 06, 2013 4:26 pm

Currently all my sripts failed that has following code --

Webdocument webdoc = "/dom[@page='xxx.cfm'];
GenericStaticClass.TypeInto(webdoc.FindSingle(.//input#'txtYearFounded']",10000),moreStats);


---- workaround - need to add domain info to make it work , there are over thousands of line that i do need to modify if this is the case
GenericStaticClass.TypeInto(webdoc.FindSingle("/dom[@page='xxx.cfm']//input#'txtYearFounded']",10000),moreStats);
Tipu

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

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by Support Team » Tue Sep 10, 2013 4:06 pm

Hello,

I have tried it on my machine using the Ranorex website and it worked without any problems.
Could you post a small project in order to show us your issue?
Thank you!

Regards,
Bernhard

andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by andreas.tastler » Thu Sep 12, 2013 9:49 am

Hello,

I have the same issue after updating to Ranorex 4.1.0. No elements will be found by using the Host.Local.Find(). I use a helper class which contains the following method

Code: Select all

public static IList<Element> Find(RepoItemInfo itemInfo, Duration timeout)
{
  return Host.Local.Find("/" + itemInfo.AbsolutePath,timeout);
}
In a codemodule I call this method an iterate over the returned list of elements.

Code: Select all

       CH_InnoSolv_UITests_CommonRepository repo = CH_InnoSolv_UITests_CommonRepository.Instance;

        IList<Element>buttons = ElementHelper.Find(repo.IsagClient.ModuleTab.TabPage.ModuleTabCloseInfo, 1000);
        foreach(Element button in buttons)
        {
          Mouse.Click(button);
        }
The absoulte path of the item ModuleTabClose is

Code: Select all

/form[@automationid='IsagClientMainForm']/tabpagelist[@automationid='tabMain']/tabpage/button[@automationid='PART_Close']
The code worked without any problem in Ranorex 4.0.3. If I use the repository item 'ModuleTabClose' in the recording, it will be clicked just fine. It seems to be a problem with the Host.Find method. Maybe a caching problem? Our application is written in WPF.

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

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by Support Team » Thu Sep 12, 2013 10:30 am

andreas.tastler wrote:f I use the repository item 'ModuleTabClose' in the recording, it will be clicked just fine. It seems to be a problem with the Host.Find method.
We have not changed anything specific to the Host.Find method. The repository internally just uses the Find method.
andreas.tastler wrote:IList<Element>buttons = ElementHelper.Find(repo.IsagClient.ModuleTab.TabPage.ModuleTabCloseInfo, 1000);
Could this just be a timing issue? A timeout of 1000 seems to be quite low for me. That would also explain why the repository can find the element, probably because the timeout is much higher.

Regards,
Alex
Ranorex Team

andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by andreas.tastler » Fri Sep 13, 2013 7:31 am

Could this just be a timing issue?
No, I tried it with 30s, but element was not found.

Yesterday, I tried to create a completely new solution in Ranorex 4.1.0, added the button to the repository and tried with the same Host.Find() call. And it worked! Maybe there is a different setting between the migrated project and the new one. I will have a closer look at this today.

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

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by Support Team » Fri Sep 13, 2013 8:27 am

I just realized a problem in the Find method you posted that might be related:
You add a "/" at the very start of the absolute item path, but that could lead to a double slash "//". Searching for an absolute path beginning with a double slash is really dangerous, because it essentially means "search all items". The search will still be aborted after the timeout, but if there are a lot of programs open, Ranorex could still be searching the first programs and might not yet got to the actual items you were looking for.

That additional "/" should not be needed at all, even if it is not there, the path will be treated as absolute since you invoke the search on the Host element.

Regards,
Alex
Ranorex Team

andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.

Post by andreas.tastler » Thu Sep 19, 2013 8:03 am

It was definitely not a timing issue.
But now it is working in all cases! I haven't seen this before. I just don't know what I have changed. But for now it seems to be OK.

Thank you.
Andreas