Page 1 of 2

Why ranorex is not switching between apps? random issue!

Posted: Tue Jun 16, 2015 12:29 pm
by aravin
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.

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

Posted: Tue Jun 16, 2015 12:53 pm
by odklizec
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?

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

Posted: Tue Jun 16, 2015 1:35 pm
by aravin
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 :)

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

Posted: Tue Jun 16, 2015 1:38 pm
by odklizec
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?

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

Posted: Tue Jun 16, 2015 1:41 pm
by aravin
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);
			}
		}

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

Posted: Tue Jun 16, 2015 3:26 pm
by odklizec
Could you please show the content of ToptoolbarArrowHover() and collectRequiredEventsFlash() methods? Do you use EnsureVisible() method in them? If not, try it.

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

Posted: Wed Jun 17, 2015 7:08 am
by aravin
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)

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

Posted: Wed Jun 17, 2015 7:43 am
by odklizec
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
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.

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

Posted: Wed Jun 17, 2015 8:04 am
by aravin
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.

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

Posted: Wed Jun 17, 2015 8:42 am
by odklizec
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.

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

Posted: Thu Jun 18, 2015 6:55 am
by aravin
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
How to fix this!!!

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

Posted: Thu Jun 18, 2015 7:32 am
by odklizec
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?

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

Posted: Thu Jun 18, 2015 11:07 am
by aravin
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.

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

Posted: Thu Jun 18, 2015 11:25 am
by odklizec
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.

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

Posted: Thu Jun 18, 2015 11:27 am
by aravin
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.