Earlier querySelector for download button was returning a div, on which we called the getAttribute function hence returning null This now returns a <span> element which returns the correct link with getAttribute