Open Browser action fails when used with Clear Cache

Ranorex Studio, Spy, Recorder, and Driver.
ssawale
Posts: 7
Joined: Fri Mar 03, 2017 7:52 pm

Open Browser action fails when used with Clear Cache

Post by ssawale » Wed Mar 08, 2017 12:32 am

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

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Open Browser action fails when used with Clear Cache

Post by qwertzu » Wed Mar 08, 2017 2:39 pm

Hi ssawale,

Try to open Ranorex Studio as administrator.
This should fix it.
Last edited by qwertzu on Thu Mar 09, 2017 12:17 pm, edited 2 times in total.

ssawale
Posts: 7
Joined: Fri Mar 03, 2017 7:52 pm

Re: Open Browser action fails when used with Clear Cache

Post by ssawale » Wed Mar 08, 2017 10:57 pm

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!

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Open Browser action fails when used with Clear Cache

Post by qwertzu » Thu Mar 09, 2017 11:14 am

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
You do not have the required permissions to view the files attached to this post.

ssawale
Posts: 7
Joined: Fri Mar 03, 2017 7:52 pm

Re: Open Browser action fails when used with Clear Cache

Post by ssawale » Thu Mar 09, 2017 8:20 pm

It works, that did the trick. I think Ranorex shouldn't be run with that checkbox on.

Appreciate your timely help Qwertzu!

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Open Browser action fails when used with Clear Cache

Post by qwertzu » Fri Mar 10, 2017 10:31 am

Hi,

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

regards,
qwertzu

Sae1962
Posts: 15
Joined: Tue Feb 06, 2018 4:25 pm

Re: Open Browser action fails when used with Clear Cache

Post by Sae1962 » Wed Mar 07, 2018 1:02 pm

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

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

Re: Open Browser action fails when used with Clear Cache

Post by odklizec » Wed Mar 07, 2018 1:32 pm

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
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

Sae1962
Posts: 15
Joined: Tue Feb 06, 2018 4:25 pm

Re: Open Browser action fails when used with Clear Cache

Post by Sae1962 » Wed Mar 07, 2018 1:50 pm

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.

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

Re: Open Browser action fails when used with Clear Cache

Post by odklizec » Wed Mar 07, 2018 1:57 pm

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).
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

Sae1962
Posts: 15
Joined: Tue Feb 06, 2018 4:25 pm

Re: Open Browser action fails when used with Clear Cache

Post by Sae1962 » Wed Mar 07, 2018 2:07 pm

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. :?

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

Re: Open Browser action fails when used with Clear Cache

Post by odklizec » Wed Mar 07, 2018 2:23 pm

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));
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

Sae1962
Posts: 15
Joined: Tue Feb 06, 2018 4:25 pm

Re: Open Browser action fails when used with Clear Cache

Post by Sae1962 » Wed Mar 07, 2018 2:33 pm

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. :?
You do not have the required permissions to view the files attached to this post.

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

Re: Open Browser action fails when used with Clear Cache

Post by odklizec » Wed Mar 07, 2018 2:41 pm

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?
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

Sae1962
Posts: 15
Joined: Tue Feb 06, 2018 4:25 pm

Re: Open Browser action fails when used with Clear Cache

Post by Sae1962 » Wed Mar 07, 2018 2:46 pm

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.)
You do not have the required permissions to view the files attached to this post.