Open Browser action fails when used with Clear Cache

Ranorex Spy, Recorder, and Studio.
McTurtle
Posts: 191
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: 3930
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: 3930
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 297 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
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