Why ranorex is not switching between apps? random issue!

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Why ranorex is not switching between apps? random issue!

Post by aravin » Tue Jun 16, 2015 12:29 pm

Hi,

In my project. I use 2 different app.

1. Fiddler App.
2. Web Browser.

I perform some operations in fiddler app, then I will perform few operations in web browser and again I will perform some operations in fiddler. In this case, switching between the application is not happening everything.
Fiddler -> Browser -> Fiddler
i.e sometime it is switching between these app. But sometimes it is not switching..

I have tried changing the basepath, still the issue occurs randomly.

Kindly give me a proper solution asap.

Thanks in adavance.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Why ranorex is not switching between apps? random issue!

Post by odklizec » Tue Jun 16, 2015 12:53 pm

Hi,

I'm afraid, it's next to impossible to help you without more details about your applications under test (does it happen with any browser or just specific one?), Ranorex project (actual test steps), element xpaths (Ranorex snapshot would be very helpful), etc. Could you please provide these details?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Why ranorex is not switching between apps? random issue!

Post by aravin » Tue Jun 16, 2015 1:35 pm

Hi,

Here is the details for you..

1. Fiddler - http://www.telerik.com/fiddler
2. Mozilla Firefox - https://www.mozilla.org/en-US/firefox/new/

Ranorex Version: 5.3.2
Tested App: Fiddler (windows App) & Flash website.
As per my company policy I can't reveal the snapshot of the project.
This issue occurs in all the browsers I have tested (IE, Chrome, Firefox). It is limitation of Ranorex?
This happens randomly not frequently.
Thank you :)

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Why ranorex is not switching between apps? random issue!

Post by odklizec » Tue Jun 16, 2015 1:38 pm

Thanks for more details. Unfortunately, there is still missing a crucial piece of info. How exactly do you switch between the apps? Please post at least the screenshot of recording/code module where we can see how exactly you switch between the apps. Also, is there displayed an error while attempting to switch between the apps?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Why ranorex is not switching between apps? random issue!

Post by aravin » Tue Jun 16, 2015 1:41 pm

Hi,

Here is the code module.

Code: Select all

private void ClickAllPublication()
		{
			try
			{
				fiddler.FiddlerInitialization();  // FIDDLER APP
				flash.ToptoolbarArrowHover();  // SWITCH TO BROWSER
				flash.AllPublicationClick();
				
				List<List<List<String>>> final=fiddler.collectRequiredEventsFlash(); // AGAIN FIDDLER APP
				InitialSetup.finalList.Add(final);
				Report.Info(InitialSetup.finalList.Count.ToString());
			}
			
			catch (Exception ex)
			{
				Report.Error("Exception"+ex.Message);
				Report.Info(ex.StackTrace);
			}
		}

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Why ranorex is not switching between apps? random issue!

Post by odklizec » Tue Jun 16, 2015 3:26 pm

Could you please show the content of ToptoolbarArrowHover() and collectRequiredEventsFlash() methods? Do you use EnsureVisible() method in them? If not, try it.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Why ranorex is not switching between apps? random issue!

Post by aravin » Wed Jun 17, 2015 7:08 am

Hi Odklizec,

Thanks for your support. I can't reveal all the code as per my company policy.

I am not using EnsureVisible(). I will try using that method and let me know the result..

Q: My project have more than 150 Test Cases, it is difficult for me to add EnsureVisible() for me in all the methods. Is there any setting in Ranorex to make default value of EnsureVisible() to all the elements.

8)

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Why ranorex is not switching between apps? random issue!

Post by odklizec » Wed Jun 17, 2015 7:43 am

Hi,

Well, I'm afraid, it's not possible to tell what's wrong or even suggest something without seeing the "switching" code. In my opinion, it's either caused by incorrect "switching" code, bad timing (typical problem in case of web-based automation) or something completely different ;)

There is an option in general settings, which globally enables/disables the use of EnsureVisible. Then each element in repository could be set to use actual (Default) state of this parameter, or forcibly enable/disable the EnsureVisible, regardless of parameter's state in settings.
EnsureVisible.png
EnsureVisible.png (103.82 KiB) Viewed 1511 times
The thing is, that it seems this option is not applied in code? At least I found it more reliable to explicitly call EnsureVisible method at some places in my code.

BTW, if you have your switching methods in each of these 150 test cases, then I'm afraid, it's a bad design. It would be much better for you to have just one "base" class containing all repeatedly used methods and then inherit this class in all your test cases (as described >here<). Then all you need to do is to change the code in this base class.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Why ranorex is not switching between apps? random issue!

Post by aravin » Wed Jun 17, 2015 8:04 am

Hi,

Thanks for the link.

I have checked that option from General Setting.

---
if you have your switching methods in each of these 150 test cases, then I'm afraid, it's a bad design.
I have 150+ test cases. Each test case will perform its own opertion (call seperate method). Is it bad practice. All those methods are in same class. Am I doing wrong?

Very Single test case will open FIDDLER APP -> WEB BROWSER -> FIDDLER APP.
This process will continue for every testcase.

Previously same logic worked on iOS & Android App. There switching happens without any issue. But switching is not happening in Web browser only.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Why ranorex is not switching between apps? random issue!

Post by odklizec » Wed Jun 17, 2015 8:42 am

Hi,

Because I don't know the actual structure of your test cases and especially the code behind the app switch, it's hard to say what's wrong and if you are doing something wrong or not ;)

I've suggested to add EnsureVisible() inside the methods performing the switch, which I suppose are methods ToptoolbarArrowHover() and collectRequiredEventsFlash()? From your answer I understood that these methods are at 150 different places and you would have to change all of them. This is definitely bad practice. All you need is a single base class containing these methods and inherit this base class in your test cases modules. Then you can call these methods as if they were a part of user code/recording modules. If you are using it this way already, then there is nothing wrong with your practice and I probably misunderstood the need to add EnsureVisible in 150 different test cases.

You see, it's really hard to help you without knowing more about your test cases, structure of your project and especially exact code behind the app switch. I would suggest you to contact Ranorex support via email ([email protected]) and do remote session with them. Otherwise, there is not much I or anyone else here can do.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Why ranorex is not switching between apps? random issue!

Post by aravin » Thu Jun 18, 2015 6:55 am

Thanks Odklizec,

Now I am using "EnsureVisible()" from General settings.

I can see that Ranorex is trying to open the window but still it is behind another application.

Kindly check the attachment, you will get some idea.
switching app.PNG
Switching App
switching app.PNG (11.38 KiB) Viewed 1494 times
How to fix this!!!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Why ranorex is not switching between apps? random issue!

Post by odklizec » Thu Jun 18, 2015 7:32 am

Hi,

I'm afraid, I'm out of ideas. EnsureVisible should bring the app to the foreground and it works quite well for me? As mentioned, it's hard to say what's wrong here without knowing more about your switching code. The only other thing that comes to my mind is minimizing the app before activating the other one. It's crude workaround, but it could do the trick?

Anyway, if you cannot expose your production code, maybe you could try to create a new test project, with just the program switching code? Just to verify if it works the same in empty project. I think there should be no problem providing us with such empty project?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Why ranorex is not switching between apps? random issue!

Post by aravin » Thu Jun 18, 2015 11:07 am

Hi odklizec,

I have created sample project in Ranorex and verified that switching between multiple app is working perfectly.

But my project is not working like that. :?:

Steps I have done:

1. Verified the path
2. Added the unique & same basepath for all element.
3. EnsureVisible() set to default in settings.

Is there any solution?

NOTE:
While workaround I found that, I have tried opening the application one by one using Ranorex. Here itself my application failed to open. Ranorex is keep on searching the element which is already exist in the desktop. I have tracked that same repo element in ranorex spy shows the element correctly.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Why ranorex is not switching between apps? random issue!

Post by odklizec » Thu Jun 18, 2015 11:25 am

aravin wrote:Hi odklizec,

I have created sample project in Ranorex and verified that switching between multiple app is working perfectly.
But have you tried the same apps (Fiddler and Web Browser)? Because if you tried different apps, this test is useless. And if you tried the same apps and switching works OK in new (empty) project, there must be something wrong in your production one. But it's hard to say what exactly is wrong without analyzing the project and your switching code.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Why ranorex is not switching between apps? random issue!

Post by aravin » Thu Jun 18, 2015 11:27 am

Hi odklizec,

I have tried differnt application. Let me try with our own application and revert back.

Updated: Our App also working without any issue.