Different behaviour of FindSingle-Method

Ranorex Spy, Recorder, and Studio.
andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Different behaviour of FindSingle-Method

Post by andreas.tastler » Fri Nov 18, 2016 2:30 pm

Hi

I search for listitems in a drop down. This is done by the following code.

Code: Select all

repo.IsagClient.Self.FindSingle(string.Format("form/form/container/listitem/text[@name~'^{0}\\.']", ID_Teilanwendung), 10000);
My Applicatio is a WPF-Application and I use the WPF Legacy Mode UiaOnly.

Now, I have a problem where my Ranorex Studio does not find an element when I execute it by "Run the selected items..." menu in the recording module.
But if I run the TestCase by "Run Selected Test Case" in the Test Suite everything is working fine.

Is there a technically difference between execution of code inside Ranorex Studio and running the whole TestCase?

Thank you.
Andreas

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Different behaviour of FindSingle-Method

Post by krstcs » Fri Nov 18, 2016 3:11 pm

Yes, there are some differences. When you run the selected modules, they will not have access to any of the TestCase's bindings or parameters. When you run the TestCase itself, then your modules WILL have access to these values, which is probably where your issue is because your variable ID_Teilanwendung is bound in the TestCase.
Shortcuts usually aren't...

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

Re: Different behaviour of FindSingle-Method

Post by andreas.tastler » Fri Nov 18, 2016 4:44 pm

But in my case, the variable ID_Teilanwendung is not set via binding, but is set by code. Even if I change it to a static value without variables, the element will only be found, if I run the TestCase from TestSuite.
I also tried to run Studio and my Application as 32bit process, run both elevated and not elevated.
Any other idea?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Different behaviour of FindSingle-Method

Post by krstcs » Fri Nov 18, 2016 5:11 pm

Could you post a ZIPPED copy of your project? Or create a small sample project that demonstrates the same issue? You could also send it directly to [email protected] if you want to get direct help from the Ranorex team.

In my view, this is still an issue of where you are getting the value from. When you run the modules by themselves, the modules will have no context for getting the value external to themselves, but if you run the test case then they have a different, external, context. As I said, this is a difference, even if you are not sure what the difference is, so without the project or a sample, it would be hard to be able to tell you exactly what your issue is.

Also, when you post about an issue, please always include the following as it can have an impact on what advice or troubleshooting is given:

FULL Ranorex version (currently only 6.0.2 and 6.1.1 are supported)
Windows version
Technology of system under test (Java, Flash/Flex, HTML, WPF, etc.)
The exact error message, if any
The RanoreXPath of the element in question, if applicable
A Ranorex Snapshot (not a screenshot) of the element in question, if applicable
A copy of a Ranorex Report showing the issue, if applicable
A copy of the project showing the issue, or a sample that demonstrates it

Without this info much of the advice we give is just guessing and it delays getting the problem solved because we don't know the full details.
Shortcuts usually aren't...