private static Boolean pollingEmail(KeyWordDetailInfo keyWordDetail, ChromeDriver driver, String url) { Boolean success = false; keyWordDetail.Comments = String.Empty; try { try { Utilities.Utilities.Log(message: "[2]", isWriteLine: false, addTime: false); driver.Navigate().GoToUrl(url); Utilities.Utilities.Log(message: "[3]", isWriteLine: false, addTime: false); } catch (WebDriverTimeoutException) { //driver.FindElement(By.TagName("body")).SendKeys("Keys.ESCAPE"); driver.ExecuteScript("window.stop();"); //((IJavaScriptExecutor)driver).ExecuteScript("window.stop();"); } KeyWordDetailInfo.TimeoutCount = 0; if (!preventPopup(ref driver, keyWordDetail)) { driver.ClosePopup(); keyWordDetail.Update(driver); Utilities.Utilities.Log(message: "[4]", isWriteLine: false, addTime: false); if (click(driver)) { Utilities.Utilities.Log(message: "[5]", isWriteLine: false, addTime: false); if (!preventPopup(ref driver, keyWordDetail)) { keyWordDetail.Update(driver); } Utilities.Utilities.Log(message: "[6]", isWriteLine: false, addTime: false); } success = !String.IsNullOrEmpty(keyWordDetail.Email); } } catch (Exception ex) { ++KeyWordDetailInfo.TimeoutCount; //driver.Navigate().GoToUrl("about:blank"); //restartDriver(ref driver); keyWordDetail.Comments = $"[Restart]{ex.Message}"; Utilities.Utilities.Log(message: "[X1]", isError: true, isWriteLine: false, addTime: false); if (KeyWordDetailInfo.TimeoutCount >= 2) { driver.Quit(); Console.Error.WriteLine("STOP"); Environment.Exit(-100); } } return(success); }
private static Boolean pollingEmail(KeyWordDetailInfo keyWordDetail, ChromeDriver driver, String url) { Boolean success = false; keyWordDetail.Comments = String.Empty; try { driver.Navigate().GoToUrl(url); keyWordDetail.Update(driver); if (String.IsNullOrEmpty(keyWordDetail.Email)) { success = driver.Click("//*[text()='Contact Us']"); keyWordDetail.Update(driver); } } catch (Exception ex) { keyWordDetail.Comments = ex.Message; } return(success); }