public static bool Run() { if (IsNetConnected) { Console.WriteLine(@"Connected!"); return(true); } IWebDriver driver = null; if (Explore.ToLower() == "chrome") { driver = new ChromeDriver(); } else { driver = new InternetExplorerDriver(); } //Notice navigation is slightly different than the Java version //This is because 'get' is a keyword in C# driver.Navigate().GoToUrl(StartUrl); try { IWebElement name = driver.FindElement(By.Id("un-userName")); IWebElement pwd = driver.FindElement(By.Id("un-password")); IWebElement login = driver.FindElement(By.Id("un-login")); IWebElement revisit = driver.FindElement(By.Id("freeCertification")); if (revisit.Displayed) { revisit.Click(); } else { name.SendKeys(UserName); pwd.SendKeys(Password); login.Click();//.SendKeys("Cheese"); } System.Threading.Thread.Sleep(10000); //if (revisit.Displayed) //{ // revisit.Click(); //} } catch (Exception ex) { Console.WriteLine(ex.Message); } var connected = IsNetConnected; Console.WriteLine($"IsNetConnected:{connected}"); driver.Quit(); return(connected); }