1

I've been search in internet for 2 hours or something like that and now I'm a bit frustrated. Sorry if the answer is "duplicated" but I can't find what I want in anywhere and I'm a bit newbie in c# so.

I have to automate a process in internet explorer, the problem is when I have to download an excel file to work with it, I don't know how can I select de "Save" option in the pop-up of open, save, save as...

I try

SendKeys.SendWait(System.Windows.Forms.Keys.Down.ToString());
SendKeys.SendWait(System.Windows.Forms.Keys.Enter.ToString());

and the same with SendKeys.Send(...); the system not simulate the down or enter, but If i do it with keyboard it works, what I want exactly is to simulate keyboard key pressing with down arrow and then enter.

((Sorry if my english is bad)) POP UP

I think that I can solve the problem if I press the save option ("guardar") simulating keyboard presses, I need to download the file but I don't know how, It have to be all automatic process without user intervention that will enter into a database fields of excel automatically every hour.

Aritzbn
  • 174
  • 3
  • 18
  • 1
    Can you please explain more, what is your actual problem, it seems that simulating keypress is not the solution. – SᴇM Sep 27 '17 at 12:42
  • I will edit the post, w8 a moment :$ – Aritzbn Sep 27 '17 at 12:43
  • 1
    Possible duplicate of [How to handle downloading a file in selenium webdriver?](https://stackoverflow.com/questions/23510816/how-to-handle-downloading-a-file-in-selenium-webdriver) – Liam Sep 27 '17 at 12:43
  • Did you check [this](https://stackoverflow.com/questions/3047375/simulating-key-press-c-sharp) and is it work for what you want to do? – Ozan Topal Sep 27 '17 at 12:43
  • Keypress isn't the the issue. Your problem is you want to download a file, the solution isn't to press Save it's to get selenium (the browser) to download the file without the popup – Liam Sep 27 '17 at 12:44
  • And, how can I get the download without the popup, the web only works on internet explorer, I search for that and i have been unable to get any solutions. – Aritzbn Sep 27 '17 at 12:48

1 Answers1

1

You should find a node in html code

<input id='fileupload'>

or something like that. Then may use

driver.FindElement().SendKeys(type absolute path to folder where do you want save file)

This is the easiest solution but if you must handling dialog you can take a look at link or similar post related to this topic (selenium dialog window)

qchar90
  • 404
  • 1
  • 5
  • 11