1

i need to open some links in firefox or chrome and after download is finished close any of them
i can open link with this command :

System.Diagnostics.Process.Start("firefox.exe", "http://www.example.com?bookid=1");

I have Firefox set to one-window mode it opens a tab. This tab is killed (but not the main window) when I issue the Kill() method and i can close opened tab with this command :

var proc = Process.Start("firefox.exe", "http://www.example.com");
proc.Kill();

but how can close specified tab with indicate with url ?

Tavakkoli
  • 97
  • 11

1 Answers1

1

Maybe not a real answer to your question, but you don't need a browser to download a file, you can do that from C# directly.

WebClient wc = new WebClient();
wc.DownloadFile(new Uri("http://stackoverflow.com"), @"C:\temp\stackoverflow.html");

I don't think it is possible to close a specific tab in FireFox, I don't think there are any APIs to help you with that. If you are looking for a controllable browser, you might want to look into CefSharp.

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325