Page 1 of 2

Open Browser action fails when used with Clear Cache

Posted: Wed Mar 08, 2017 12:32 am
by ssawale
I am using Ranorex Studio 6.2.1 on windows 7 64 bit and Chrome browser version Version 55.0.2883.87 m

When I use action Open Browser and set Clear Cache property to True it fails to open a chrome browser with following error. It works fine when I set it to False and rest all properties to default

Failed to open URL 'https://$Mywebsiteaddress' with browser chrome.
Access to the path 'data_0' is denied.

Any idea as what could be the issue and how to resolve it?

Thanks!
Sanjay

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 08, 2017 2:39 pm
by qwertzu
Hi ssawale,

Try to open Ranorex Studio as administrator.
This should fix it.

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 08, 2017 10:57 pm
by ssawale
Thanks qwertzu for your reply, We don't have admin privileges on the VM, its very difficult to get those rights for testing purpose.

As a normal user, it doesn't require admin privileges to clear browser cache so why does the Ranorex tool need elevated privileges to perform this action, can it mimic the normal user behavior to perform the action?

Thanks!

Re: Open Browser action fails when used with Clear Cache

Posted: Thu Mar 09, 2017 11:14 am
by qwertzu
Hi ssawale,

It seems like there are some problems with chrome processes running in the background.
Please try to disable the "Continue running background apps when Google Chrome is closed" - checkbox within the Chrome advanced settings (see screenshot).

Additionally in the end of your test, close the browser with a kill application action.

This worked on my machine without administrator rights.

regards,
qwertzu

Re: Open Browser action fails when used with Clear Cache

Posted: Thu Mar 09, 2017 8:20 pm
by ssawale
It works, that did the trick. I think Ranorex shouldn't be run with that checkbox on.

Appreciate your timely help Qwertzu!

Re: Open Browser action fails when used with Clear Cache

Posted: Fri Mar 10, 2017 10:31 am
by qwertzu
Hi,

You are welcome.
I´m glad that everything works for you now.

regards,
qwertzu

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 07, 2018 1:02 pm
by Sae1962
Hello!

I made the same setting to Google Chrome (v 64.0.3282.186 (official build) (64 bit)), but still have the same problems. When I enter the KillBrowsers flag in OpenBrowser to true, this problem occurs on some iterations, but the iteration number is not always the same; actually, I have six iterations, where the test variables are fed from a CSV file. :(

Best regards!
Sae1962

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 07, 2018 1:32 pm
by odklizec
Hi,

I believe you are experiencing a known "Access is denied" error while using Open Browser action with enabled "kill existing" flag? The solution is to add a small delay after closing browser and before opening new one (with kill existing flag). In other words, you should not rely on Open Browser action with kill existing switch. Simply close the browser at the end of test case and add small delay before Open Browser action (5s should be just enough).
https://www.ranorex.com/forum/ranorex-h ... tml#p46121

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 07, 2018 1:50 pm
by Sae1962
odklizec wrote:…I believe you are experiencing a known "Access is denied" error while using Open Browser action with enabled "kill existing" flag? The solution is to add a small delay after closing browser and before opening new one (with kill existing flag). …
Thank you for the reply! I added delays to the code:

Code: Select all

		public static void OpenBrowserRecording_Open_browser(string browserName, string ipAddress, int height, int width)
		{
			string dimensions = (browserName == BaseCodeCollection.EBrowserType.chrome.ToString())
				? "--window_size=" + width.ToString() + ',' + height.ToString()
				: "";
			
			Report.Log(ReportLevel.Info, "Website", "Opening web site '" + ipAddress + "' with browser '"
			           + browserName + "' and a size of '" + dimensions.Replace(',', '×') + "'.");
			System.Threading.Thread.Sleep(5000);	// Wait for five seconds to get rid of blocking processes
			Host.Current.OpenBrowser(ipAddress, browserName, dimensions, true, false, false, false, false);
			System.Threading.Thread.Sleep(5000);	// Wait for five seconds to get rid of blocking browser processes
		}

Unfortunately, the problem remains.

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 07, 2018 1:57 pm
by odklizec
You should first use Close Application command before using OpenBrowser (with kill browser switch). And add delay between these two actions. It's a Chrome issue. In other words, you should not rely on closing browser via Open Browser action and Kill Existing flag (in case of Chrome).

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 07, 2018 2:07 pm
by Sae1962
odklizec wrote:You should first use Close Application command …
I wrote the following

Code: Select all

		public static void OpenBrowserRecording_Open_browser(string browserName, string ipAddress, int height, int width)
		{
			string dimensions = (browserName == BaseCodeCollection.EBrowserType.chrome.ToString())
				? "--window_size=" + width.ToString() + ',' + height.ToString()
				: "";
			
			Report.Log(ReportLevel.Info, "Website", "Opening web site '" + ipAddress + "' with browser '"
			           + browserName + "' and a size of '" + dimensions.Replace(',', '×') + "'.");
			System.Windows.Forms.Application.Exit();
			System.Threading.Thread.Sleep(5000);	// Wait for five seconds to get rid of blocking browser processes
			//Host.Current.OpenBrowser(ipAddress, browserName, dimensions, false, false, false, false, false);
			Host.Current.OpenBrowser(ipAddress, browserName, dimensions, true, false, false, false, false);
		}
Unfortunately, there seems still to be an error. :?

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 07, 2018 2:23 pm
by odklizec
And you still getting "Access is denied" error? Then try to increase the delay. And make sure Chrome is not running in background, as described here:
https://www.ranorex.com/forum/posting.p ... 18#pr42594

Also, I'm not quite sure using System.Windows.Forms.Application.Exit() is the best way to close browser? Try to use this instead:

Code: Select all

Host.Current.CloseApplication(YourRepo.DomElement.Self, new Duration(0));

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 07, 2018 2:33 pm
by Sae1962
odklizec wrote:And you still getting "Access is denied" error? …
No, I get the "Failed to open URL" error. By the way: I start Ranorex as an administrator. :?

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 07, 2018 2:41 pm
by odklizec
It's the same error. It's just that you are getting it in German language... Zugriff verweigert = access is denied ;) In my opinion, the browser is not yet closed before Open Browser action is fired?

What happens if you increase the delay between Close Browser and Open Browser? Also, are you pretty sure there is disabled "Continue running background apps when Google Chrome is closed" option?

Re: Open Browser action fails when used with Clear Cache

Posted: Wed Mar 07, 2018 2:46 pm
by Sae1962
Yes, I reset this option after reading this post.

I increased the sleep time to 15 seconds. Unfortunately, the access is still denied. :( I think that the OpenBrowser option killExisting is useless for Google Chrome. (I think the best way to find out the reason for this is to give one of the experts access to my PC so that the problem can easily be understood.)