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!
Here are a few things that will make this easier and reliable for you.
Close Tabactivity 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.)
Protective Cheks: To improve accuracy and reliability, add protective checks such as
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.
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
Try these out, I am confident your bot will produce significantly better results.
The Attach Browser tip in #1 above is golden! I had tried the Close Tab earlier, but was having difficulty getting the selector right.
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.
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:
Copied the link.
Copied the URL to the
End Pointfield. Left all the other options to Default.
All options Default on
Download Resourcecheckbox and gave it a path:
You can use variables instead of the hardcoded URL and filename.
Hopefully, this will make your life easier!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.