La liste de diffusion est fermée depuis juillet 2022, mais sert toujours d'archive d'informations sur QF-Test.
Cependant, si vous souhaitez rester informé des nouveautés concernant QF-Test, vous pouvez simplement vous abonner à la newsletter :
abonner à la newsletter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [QF-Test] File download from firefox
Hello Marek, if you open the browser using the WebDriver connection mode (which is always the case if you like to test with a Firefox browser newer than version 43), the automatic dialog handling is currently not available (due to restrictions of the WebDriver W3C protocol, which has no support for controlling such boxes). In fact, you already named the options we can provide. Some small complementary information: * QF-Test 4.2 comes with the uiauto scripting module, which allows fine control over Windows controls using the UIAutomation API. These would probably offer you more options than the classic autowin. * For the proposed direct http-download, you can use a jython script with the urllib2 module , which provides options for Authentication * The easiest way would be to set the firefox settings to direct download. You can do this using a jython SUT script in your browser startup sequence, after "Start Web-Engine", but before "Open Browser Window": import tempfile folder = tempfile.mkdtemp(".downloads") rc.setGlobal("downloadFolder",folder) rc.engine.preferences().setIntPref("firefox","browser.download.folderList",2) rc.engine.preferences().setBoolPref("firefox","browser.download.useDownloadDir",True) rc.engine.preferences().setStrPref("firefox","browser.download.defaultFolder", folder) rc.engine.preferences().setStrPref("firefox","browser.download.dir", folder) rc.engine.preferences().setBoolPref("firefox","pdfjs.disabled",True) You can also force the download of specific files by listing their mime types: rc.engine.preferences().setStrPref("firefox","browser.helperApps.neverAsk.saveToDisk", "application/x-xxxx, ...") Then you can pick the file from the specified directory (stored in the downloadFolder variable), possibly using a regular expression (due to the timestamp in it). Sincerely, Pascal Bihler  https://docs.python.org/2/library/urllib2.html#abstractbasicauthhandler-objects -- ________________________________________________________________ PDF Testing, REST/SOAP, Angular, SmartGWT, Selenium Integration QF-Test 4.2: The Test Tool for Java and Web GUIs Free Download: https://www.qfs.de/en/qf-test/download.html ________________________________________________________________ Dr. Pascal Bihler Development & Support E: support@?.de T: +49 8171 38648-20 F: +49 8171 38648-16 Quality First Software GmbH | www.qfs.de Tulpenstr. 41 | 82538 Geretsried | Germany GF Gregor Schmid, Dr. Martina Schmid, Karlheinz Kellerer HRB München 140833 Am 26.03.18 um 13:50 schrieb Nedvěd, Marek: > Hello, > > We are currently testing one of our web applications with qf-test and we > stumbled upon a file download. At some point we would like to download a *.zip > file from the website. In Chrome and IE we simply click on the “small dialog” > and the in the following select node we specify the path. But the firefox > doesn’t show this dialog, instead it shows directly the proper download dialog, > which we cannot simply control. > > > > From what I’ve learned, there are 3 options how to overcome this: > > · Either write some autowin script, that would interact with the > Download dialog and save it. The downside is, that we cannot affect the > directory, to which the file gets downloaded or the name of the file. (which is > sadly generated with a timestamp) > > · Or we can create a simple http client, send GET request and download > the file from the response. This should work, but I am not sure how it would > work with authentification, cookies and such. > > · The last option that others do is to prepare a firefox profile, that > always downloads this type of file to a known location and use this profile at > the start of the browser. Which seems complicated and has the same disadvantage > as #1 > > > > So the question is, how do I download simply a file from firefox? Is there some > other way? > > > > Best regards, > > Marek Nedvěd > > > > _______________________________________________ > qftest-list mailing list > qftest-list@?.de > https://movement.qfs.de/mailman/listinfo/qftest-list >