0

I'm using Webdriver to perform all the UI actions. I want to download an excel file on Click operation of a WebElement. The below is the html code of the application.

<span class="excel ExcelLink" onclick="document.expForm.submit();">Download Excel</span>

I'm getting error has this WebElement doesn't have any 'href' attribute present in this. Hence I can't use the "HttpClient" to retrieve the file. how to download in this file in java / javascript?

Kindly suggest.

TimeToCode
  • 901
  • 2
  • 16
  • 34
Sam
  • 543
  • 3
  • 10
  • 27

1 Answers1

-2

can u post full link to website? I think you are getting into this from wrong way. See that this element isnt anchor with href button but i suppose its form that redirects U to the file ( maybe file isn't on server just generated for download and than destroyed?). Have U tried executing onclick function??

 <button onclick="myFunction()">Click me</button>

@Luke Park, sorry for that, but i cant make only comments yet. I have to earn 50 points. Sorry if U not welcome with that. Here u have some code.

Python way: downloading file using selenium

Community
  • 1
  • 1
grzeniuk
  • 1
  • 2