Ranorex Studio 4.1.0 cannot find objects that Spy can find.
-
- Posts: 54
- Joined: Wed Jan 09, 2013 7:02 pm
Ranorex Studio 4.1.0 cannot find objects that Spy can find.
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.
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.
- Support Team
- 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.
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:
This would help us to analyze your issue.
Thank you in advance.
Regards,
Markus (T)
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)
-
- Posts: 54
- Joined: Wed Jan 09, 2013 7:02 pm
Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
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.
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.
-
- Posts: 54
- Joined: Wed Jan 09, 2013 7:02 pm
Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
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.
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.
Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
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");
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
Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
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.
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.
- Support Team
- 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.
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?
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)
@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)
Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
Element '{InputTag:'txtSubject'}' does exist.
Tipu
Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
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);
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
- Support Team
- 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.
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
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
-
- Posts: 36
- Joined: Mon Sep 20, 2010 10:59 am
Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
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
In a codemodule I call this method an iterate over the returned list of elements.
The absoulte path of the item ModuleTabClose is
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.
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);
}
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);
}
Code: Select all
/form[@automationid='IsagClientMainForm']/tabpagelist[@automationid='tabMain']/tabpage/button[@automationid='PART_Close']
- Support Team
- 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.
We have not changed anything specific to the Host.Find method. The repository internally just uses the Find method.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.
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.andreas.tastler wrote:IList<Element>buttons = ElementHelper.Find(repo.IsagClient.ModuleTab.TabPage.ModuleTabCloseInfo, 1000);
Regards,
Alex
Ranorex Team
-
- Posts: 36
- Joined: Mon Sep 20, 2010 10:59 am
Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
No, I tried it with 30s, but element was not found.Could this just be a timing issue?
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.
- Support Team
- 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.
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
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
-
- Posts: 36
- Joined: Mon Sep 20, 2010 10:59 am
Re: Ranorex Studio 4.1.0 cannot find objects that Spy can find.
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
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