I'm downloading a file by clicking a button from chrome with the WebDriver functionality:
sess = StartWebSession[Visible->True]
WebExecute[sess, "ClickElement" -> el] (* el is download button *)
This works just fine, and when it finishes it gives a success object:
Success["ClickElement", Association[
"MessageTemplate" :> "`command` was successful.",
"MessageParameters" -> Association["command" -> "ClickElement"],
"Element" -> "0.5797105527746262-24"]]
My question is two-fold:
- I need a file handle to the finished download (and if it failed to download I need to know that).
- Why doesn't it work when session is not visible. In particular, it gives success but doesn't actually download, for example:
sess = StartWebSession[Visible->False];
WebExecute[sess,
"OpenPage" -> "https://datarepository.wolframcloud.com/resources/Patient-Medical-Data-for-Novel-Coronavirus-COVID-19"];
a = WebExecute[sess, "LocateElements" -> "Tag" -> "a"];
p = Position[WebExecute[sess, "ElementText" -> a],
"Source Notebook"][[1, 1]];
WebExecute[sess, "ClickElement" -> a[[p]]]
Import
straight on the file you want to download? $\endgroup$WebExecute
? $\endgroup$Import
worked pretty well for me with the file in your example "Patient-Medical-Data-for-Novel-Coronavirus-COVID-19-definition.nb". What problems do you have with it? You have also many different functions for downloading likeURLDownload
orURLDownloadSubmit
and others. Give me an example when these functions andImport
do not work. $\endgroup$