Save and Close Browser Tab-Hotkey, Type Into, Mouse Click - Inconsistent

In a For-Each loop, I would like to open a URL, save it (Ctrl-s), then close it (Ctrl-w). I have tried Hotkeys, Type into, and mouse selection for the save and close with very inconsistent results. In a give for-each loop, it may work for 3 files and then stop for 2 and then work again for 10… I welcome any suggestions as I don’t want to “babysit” the run for 1000 URLs. Thank you!

Hi @cora.knutson

Here are a few things that will make this easier and reliable for you.

  1. Use Close Tab activity instead of hotkeys CTRL + W
    It’s always recommended to use standard activities if available, and use hotkeys as fallback or workaround if necessary.
    (Tip: When you use Attach Browser on the webpage, use its ‘Output’ property to create a browser object. The ‘Close Tab’ accepts browser object which will save you the trouble of configuring selectors.)
  2. Protective Cheks: To improve accuracy and reliability, add protective checks such as
    Element Exists or Get Active Window.
    A series of hotkeys works faster than our usual human experience. In other words, the if one CTRL+W command works too fast.
    For example, When you use CTRL+S, I assume you get a ‘Save As’ dialog to save the webpage as HTML. When the bot presumably clicks ‘Save’, it won’t wait until the save dialog has closed before it fires CTRL+W command.
    A check to see if the Save window has disappeared is a good way to avoid errors.
  3. Add delays
    The last resort, of sorts, is to consider using delays if the protective checks are not as effective as you expect. Use the ‘Delay Before’ and ‘Delay After’ options in activities such as Click and Type Into

Try these out, I am confident your bot will produce significantly better results.
Good luck!

  1. The Attach Browser tip in #1 above is golden! I had tried the Close Tab earlier, but was having difficulty getting the selector right.

  2. I’m still going through the training. Do you have suggestions on how to to be use the protective check for a PDF being loaded in Chrome? (or do you suggest another browser?) I’m not getting the ‘Save As’ box to come up every time. Perhaps the URL isn’t all the way loaded yet?? I tried typing into the window (“[d(ctrl)]s[u(ctrl)]”), with the idea that it wouldn’t type until the load was done, but that doesn’t seem to work either.

Thank you!

I should have checked this sooner, but reading through your issues got me doing some research.

Have you checked this out? Apparently, the HTTP Request activity is an easy-to-use trick to download the pdf file you want.

Here is what I did to test this:

  1. Copied the link.

  2. Copied the URL to the End Point field. Left all the other options to Default.

  3. All options Default on Response tab.
    Checked Download Resource checkbox and gave it a path:
    Data\Sample-Test.pdf

  4. Et voila!
    image

You can use variables instead of the hardcoded URL and filename.
Hopefully, this will make your life easier!
Happy automation!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.