web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Subflow to clear cache...
Power Automate
Unanswered

Subflow to clear cache doesn't seem to work, window not closing

(0) ShareShare
ReportReport
Posted on by 674

Hello,

So I have a flow that goes to a webpage, logs in and does what it needs to do. Every so often the login has an issue (an issue on the website's side, not something I can fix), that needs the cache cleared.  So on the step, I did the following error control : 

CharlesBrewer_0-1692735431215.png

So the subflow it goes to looks like this : 

CharlesBrewer_1-1692735513979.png

I am being extra cautious, but I assume what this should do is close all chrome windows with CMD prompt, then open up a chrome window to clear the cache, then close it.  The "launch new chrome" has the clear cache step : 

CharlesBrewer_2-1692735591266.png

It sends me an email to let me know (for testing) and then I have it wait a moment to be extra cautious. It then, per the error control I assume, will exit the subflow and go to the "paccarlogin" label. 

 

CharlesBrewer_3-1692735690671.png

After the paccarlogin (back in the main flow) is another CMD clear, for extra caution.  So the part that is not working, is for some reason a chrome window is still staying open. So the cache isn't getting cleared correctly and I just get stuck in a loop and 300 emails before I can get in in the morning and kill it.  Is there something I am doing super wrong? I don't understand why all the chrome windows are not closing.

I have the same question (0)
  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    I would usually use Terminate process instead of the CMD interface to do this. Also, you could do a loop and check if the Chrome process is running via the If process condition. And keep terminating it until it is no longer running, assuming that this only terminates one instance, where there might be several of them running.

    What usually works for me to close Chrome is a sub-flow that closes the window by using Close window via the window title (with * as a wildcard to ignore the page title) and class. Then waiting for the process to stop via Wait for process with a timeout, and checking if the process is still running. Ff it is, then I terminate it.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • CharlesBrewer Profile Picture
    674 on at

    @Agnius 

    Thanks for the response. I believe the taskkill "should" kill all the windows/processes, unless I am doing it wrong. I've tested it though with multiple chrome windows open and it does close all of them. That's why I am confused that a window seems to linger open, thus cache is not being cleared very well. However for testing purposes I added this after the CMD taskkill (I'll get rid of it later if it seems to work).

    CharlesBrewer_0-1692804619944.png

    Does this look like what you mean? I tested just the If process and it seems to be working....but so does the CMD one so, who knows.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    More or less, but I would also add a Wait for process action before the If process, so that it waits for Chrome to close completely before continuing. Set it to have a timeout of some seconds and make it continue to the next action on error. This way it will wait a bit after your taskkill command and then check if the process is still running.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • CharlesBrewer Profile Picture
    674 on at

    Will do! It's hard to test I'll just wait until it breaks again and hope for the best, thanks for the recommendations.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard