From c1c0c50f086f48031b3d03390396fad2e51bdead Mon Sep 17 00:00:00 2001 From: chodadoo Date: Sun, 15 Aug 2021 02:28:42 +0900 Subject: [PATCH] =?UTF-8?q?1.=20=EA=B2=BD=EA=B3=A0=EC=B0=BD=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SmartSearch/SmartSearch.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/SmartSearch/SmartSearch.cs b/SmartSearch/SmartSearch.cs index 2bd9344..d9672c5 100644 --- a/SmartSearch/SmartSearch.cs +++ b/SmartSearch/SmartSearch.cs @@ -393,6 +393,20 @@ namespace SmartSearch { // 페이지 이동 후 대기 및 끝 탭 설정 _IWebDriver.SwitchTo().Window(_IWebDriver.WindowHandles.Last()); + + WebDriverWait _WebDriverWait = new WebDriverWait(_IWebDriver, TimeSpan.FromSeconds(5)); + + try + { + _WebDriverWait.Until(ExpectedConditions.AlertIsPresent()); + _IWebDriver.SwitchTo().Alert().Accept(); + } + catch (Exception ex) + { + Trace.WriteLine("=== 경고창 검사 ==="); + Trace.WriteLine(ex.Message); + } + ((IJavaScriptExecutor)_IWebDriver).ExecuteScript("window.scrollBy(0, document.body.scrollHeight);"); Thread.Sleep(m_Random.Next((int)optSearchWaitMin, (int)optSearchWaitMax)); }