-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to save content of data url to file #347
Comments
Woud be nice to have ability to use |
And additionally, having posibility to set headers :) |
@Taxanas how would such a post work? Which data (and headers should be posted)? I believe for these POST downloads, the currently available alternative, of using HttpTest is the only viable option. |
@fhoeben , sorry, responding just now: I believe this should be handled not in BrowserTest, but in HttpTest class. Such post should work as Either way, i managed to make a workaround already to this case in headless chrome on remote grid, so its not so relevant anymore. |
How does such POST (which automatically downloads the content) look like? In my case I need to perform a POST, then a PDF is returned. When I create a new file (with FileFixture) the document content is somehow corrupted and eventually it doesn't display the PDF (just a blank document) |
@roydekleijn if there is a problem POSTing using HttpTest and then saving to file, please create a separate issue. What you appear to be describing does not seem to be related to this (original) issue. |
Currently BrowserTest supports downloading the target of a link or source of an image to file. But content does not always have to be a separate resource that can be retrieved on its own (by http get). It can also be included in the web page as a so called data url.
JsonHttpTest already supports saving of binaries encoded in that format to file. It would be great if BrowserTest's download functionality would also (transparently) support this.
This could be used for images, but also for PDFs embedded in an iframe (where the PDF content is the iframe's
src
) see #346This is probably quite easy to implement; in
downloadContentFrom()
just check whether the URL is a data-url (using the already existingDataUrlHelper
) and if so save the content directly from the URLs content instead of doing a http GET to retrieve the file.Of course no filename would be known, so one has to be automatically generated. If the data URL contains a content type this should be used to determine the extension of the file.
The text was updated successfully, but these errors were encountered: