actualmente quiero cerrar el navegador despues de ejecutar una rutina diaria, llevo días intentandolo, incluso con selenium pero por cuestiones de versiones entre selenium y los navegadores no me permite usarlo, por lo tanto ya no uso selenium
Estuve trabajando en este código pero al final no me cierra el navegador, se queda abierto, espero puedan ayudarme, saludos!
public static void Main(string[] args)
{
string[] uri = new string [5] { "http://www.google.com", "http://www.yahoo.com", "http://www.linkedin.com", "http://www.stackoverflow.com", "http://www.microsoft.com" };
int urlCurrentIndex = 4;
Console.WriteLine("Welcome to the Daily Routine\n");
while (urlCurrentIndex < 5)
{
foreach (string i in uri){
var exe = new ProcessStartInfo("explorer.exe");
exe.Arguments = i;
Process.Start(exe);
var process = Process.GetCurrentProcess();
if (process != null)
{
Console.WriteLine("Routine in progress...");
Console.WriteLine(i);
Thread.Sleep(1000);
process.Close();
urlCurrentIndex++;
if (urlCurrentIndex <= 4)
{
Console.WriteLine("Routine has been completed.");
process.Kill();
}
}
else
{
Console.WriteLine("Routine failed.");
}
}
}