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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

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

(0) ShareShare
ReportReport
Posted on by 697

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 252 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard