cypress-io / cypress-example-recipes

Various recipes for testing common scenarios with Cypress

Home Page:https://on.cypress.io/examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

show how to do file downloads using dynamic anchor attribute

bahmutov opened this issue · comments

Probably should work right out of the box

var a = document.createElement('a');
a.setAttribute('href', dataUri);
a.setAttribute('download', filename);

var aj = $(a);
aj.appendTo('body');
aj[0].click();
aj.remove();