Open Browser action fails when used with Clear Cache

Ranorex Spy, Recorder, and Studio.
McTurtle
Posts: 255
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Open Browser action fails when used with Clear Cache

Post by McTurtle » Thu Mar 08, 2018 2:54 pm

Hello Sae1962,

If you check the code in the post, then you will see that the "killexisting" flag is set to false for the open-browser action: Ranorex.Host.Local.OpenBrowser throws Win32Exception

From your post I am not sure that you have set this to false. Simply make sure that the following is considered:
1. When one iteration is finished there is a close browser at the end of that iteration.
2. The new iteration starts with a 10 sec delay or the previous one ends with a 10 sec delay.
3. Only after that the Open-Broweser action is called and the kill-existing flag is set to false.

Does it work now?

Regards,
McTurtle

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

Re: Open Browser action fails when used with Clear Cache

Post by odklizec » Thu Mar 08, 2018 3:06 pm

Hi McTurtle,

The point of delay is that the OpenBrowser action (with ENABLED KillExisting flag) does not fail with "Access is denied" message. In other words, if KillExisting is False, there is no need for adding delay before OpenBrowser action ;) But I guess this is what Sae1962 actually wants...Open Browser action with enabled Kill Existing flag?
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 » Fri Mar 09, 2018 10:35 am

Is there any solution for this problem? If you are a Ranorex expert, you may access my PC to see on the premises what happens.

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

Re: Open Browser action fails when used with Clear Cache

Post by odklizec » Fri Mar 09, 2018 10:45 am

Hi,

The solution is Close Browser, add delay (at least 5000ms) after Close Browser action or before Open Browser action. This workaround definitely works.

Are you using close browser as mentioned in one of my my previous posts?...

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 » Fri Mar 09, 2018 10:52 am

Here is my code. Unfortunately, I do not know how to determine MyRepo at that code location. Therefore, I cannot use exactly your method call.
Attachments
20180309 OpenBrowserRecording_Open_browser.PNG
Class with access-denied problem
20180309 OpenBrowserRecording_Open_browser.PNG (73.64 KiB) Viewed 683 times

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

Re: Open Browser action fails when used with Clear Cache

Post by odklizec » Fri Mar 09, 2018 11:58 am

You need to instantiate your repository so it will be visible in code module.

Code: Select all

using Ranorex.Core.Repository;
...
    public class UserCodeCollection
    {
        private static ProjectName.ProjectNameRepository repo = ProjectName.ProjectNameRepository.Instance;
        ...
        Host.Current.CloseApplication(repo.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

mattmccall
Posts: 30
Joined: Mon Nov 12, 2012 8:13 pm

Re: Open Browser action fails when used with Clear Cache

Post by mattmccall » Wed Mar 20, 2019 7:46 pm

I am having the exact same issue now. Was a resolution found?

Ranorex 8.3.1

I am trying to find a way to execute tests without needing to run Ranorex as admin. I cannot give the access to everyone to be able to do run Ranorex as admin. If everyone runs as admin I do not have a problem.

I have all the settings and tricks mentioned in this thread and I am still getting the error.

If another user is logged in and executing tests Chrome is open and if I try to run my tests I get the error. Once those tests are done and the Chrome processes are closed then my tests work as expected.

User avatar
N612
Posts: 93
Joined: Mon Jul 11, 2016 4:01 pm

Re: Open Browser action fails when used with Clear Cache

Post by N612 » Fri Mar 22, 2019 11:07 pm

mattmccall wrote:
Wed Mar 20, 2019 7:46 pm
I am having the exact same issue now. Was a resolution found?

Ranorex 8.3.1

I am trying to find a way to execute tests without needing to run Ranorex as admin. I cannot give the access to everyone to be able to do run Ranorex as admin. If everyone runs as admin I do not have a problem.

I have all the settings and tricks mentioned in this thread and I am still getting the error.

If another user is logged in and executing tests Chrome is open and if I try to run my tests I get the error. Once those tests are done and the Chrome processes are closed then my tests work as expected.
Just to confirm your issue is the same as the one initially mentioned on this thread, are you receiving an "Access to the path 'data_0' is denied" error when trying to launch Chrome with the "Clear cache" or "Kill Existing" property set to "True"?

If so, this can be resolved by ensuring all Chrome processes are fully closed before launching Chrome with either of these properties enabled. Even background Chrome process will cause this error. The easiest way to ensure Chrome does not remain open in the background after closing it is to disable the below option in Chrome (under "Advanced" settings).
disabled.png
disabled.png (8.73 KiB) Viewed 225 times
Hope this helps!