unable to click on Save button while downloading the Excel file using Webdriver in Java

728 views
Skip to first unread message

Umamaheshwar Thota

unread,
Dec 3, 2013, 5:06:11 AM12/3/13
to webd...@googlegroups.com
Hi All,

I am unable to click on Save button while downloading the Excel file using Webdriver in Java as in attached screen shot. I have searched the forum and found the answers but unable to get the results. I am using IE9 browser and my client uses only IE browsers.

enter image description here

Can anyone please help me to download the Excel file using Web driver in Java. In the screenshot i have removed the actual URL.

This requirement in IE browser.

Help will be appreciated.

Thanks in Advance,
Mahesh
issue.jpg

Chris Merrill

unread,
Dec 3, 2013, 9:45:49 AM12/3/13
to webd...@googlegroups.com
That button is not part of the page, so no, you can't click on it.

Even if you could, what would you do next? The file download is already in
progress at this point, so you can continue testing the next step in your web
application -- it doesn't matter if you click on the button or not.

For further information on this topic, try googling a bit - this topic (saving
a file download with Selenium / WebDriver) has been discussed at length on several
occasions.

Chris


On 12/3/2013 5:06 AM, Umamaheshwar Thota wrote:
> Hi All,
>
> I am unable to click on Save button while downloading the Excel file using Webdriver in Java as in
> attached screen shot. I have searched the forum and found the answers but unable to get the results.
> I am using IE9 browser and my client uses only IE browsers.
>
> enter image description here
>
> Can anyone please help me to download the Excel file using Web driver in Java. In the screenshot i
> have removed the actual URL.
>
> This requirement in IE browser.
>
> Help will be appreciated.
>
> Thanks in Advance,
> Mahesh
>
> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> webdriver+...@googlegroups.com.
> To post to this group, send email to webd...@googlegroups.com.
> Visit this group at http://groups.google.com/group/webdriver.
> For more options, visit https://groups.google.com/groups/opt_out.


--
------------------------------------------------------------------------ -
Chris Merrill | Web Performance, Inc.
ch...@webperformance.com | http://webperformance.com
919-433-1762 | 919-845-7601

Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -

Andreas Tolfsen

unread,
Dec 3, 2013, 7:02:34 AM12/3/13
to webd...@googlegroups.com

thotam...@gmail.com writes:

> Hi All,

Hi!

> I am unable to click on Save button while downloading the Excel file
> using Webdriver in Java as in attached screen shot. I have searched
> the forum and found the answers but unable to get the results. I am
> using IE9 browser and my client uses only IE browsers.

It's not possible to interact with the browser's chrome using
WebDriver. You should also reconsider whether using Selenium to
download files is the right option for you; it's not what Selenium's
designed for.

I don't know IE very well, but there might be a setting that enables
automatic downloads without confirmation.

Ajay Talpur

unread,
Dec 3, 2013, 10:50:52 PM12/3/13
to webd...@googlegroups.com

try this code

For IE to save a file click ALT+S to open ALT+O

so

    Robot robot=new Robot();
    robot.keyPress(KeyEvent.VK_ALT);
    robot.keyPress(KeyEvent.VK_S);
    robot.keyRelease(KeyEvent.VK_ALT);
    robot.keyRelease(KeyEvent.VK_S);
Thread.sleep(3000);

and your file will be downloaded

-Ajay

Umamaheshwar Thota

unread,
Dec 5, 2013, 6:56:43 AM12/5/13
to webd...@googlegroups.com
Thanks for the reply. i have tried using the below code. but I am not able to download the excel fiel.

regards,
Mahesh

darrell

unread,
Dec 5, 2013, 1:59:39 PM12/5/13
to webd...@googlegroups.com
Ajay's code assumes a LOT of things. So it is not surprising that it does not work. If downloading a file was an easy thing and had a universal solution, it would be part of WebDriver. Try searching this group for "file downloading" and see what you find. This question has been answered many times. The general idea is that selecting the file and getting past "Are you sure?" type prompts is outside of WebDriver. So once these come up you need to use a Desktop automation like AutoIt or Java's Robot. The other option is to avoid the OS level dialogs/prompts with tricks to get around them. Again, search the group for "file downloading".

Darrell
Reply all
Reply to author
Forward
0 new messages