0

I have a requirement to select a table record and click on a download button. (I guess the download button has a .js to download the file under selected table record) which will store the file in the OS in .tbz format. once its prompted, open the tar file and verify its content.

I managed to do the click on a table record and click on download button. but it opens a download window, which is not recognized in selenium. the downloadable file is under a web layer, unable to track it with href.

Any help is appreciated.

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
Rex angel
  • 3
  • 3

1 Answers1

0

Selenium/Webdriver can only interact with browsers. So, you cannot do the part where you are verifying the contents of the tar. However, you might try to find libraries in the language of your choice which might help you with unzipping the tar file and do verifications ..a link if it helps (How do I extract a tar file in Java?)

Coming back to the browser part, you cannot interact with the download window since it is an OS level window as such. The thing that you can try doing is, set your download settings in the browser where you are testing and make them so that there is an autodownload to a specific folder from where you can proceed with the non-selenium implementation.

Community
  • 1
  • 1
niharika_neo
  • 8,441
  • 1
  • 19
  • 31
  • Thanks Neo, for the tar file extraction. could you explain the download part in bit more detail please. – Rex angel Feb 20 '13 at 12:43
  • eg. for firefox, if you try downloading a xls, you would get an option of a checkbox, do this for all files of this type. Check that and then you can edit it from the applications section of your tools->Options for firefox. Next time it would autodownload the file. So use this profile for your runs and the autodownload settings would work. – niharika_neo Feb 20 '13 at 12:56
  • I tried, i guess its under a layer. am unable to see any downloadable in the firefox (downloadthemAll) plugin. – Rex angel Feb 21 '13 at 05:00
  • Ok..you can also set your profile settings for autodownload from your code..refer this thread..http://stackoverflow.com/questions/13839544/using-selenium-webdrivers-method-browser-helperapps-neverask-savetodisk-how-ca – niharika_neo Feb 22 '13 at 09:49
  • Thanks Neo. the code in the reference link is setting the profile, but not saving the downloaded file. for the second part of my query, i found a solution. am able to extract and compare the file names. – Rex angel Mar 04 '13 at 08:43