コード例 #1
0
        public void logout()
        {
            Thread.Sleep(1000);
            IWebElement sign_out_button = driver.FindElement(By.ClassName("logout"));

            sign_out_button.Click();
            IWebElement page_heading = driver.FindElement(By.CssSelector("#center_column > h1"));

            Assert.AreEqual("AUTHENTICATION", page_heading.Text);

            driver.Quit();
        }
コード例 #2
0
        public void CleanUpFront()
        {
            if (TestContext.CurrentTestOutcome != UnitTestOutcome.Passed)
            {
                Test.Fail(GetErrorMessage());
            }

            Extent.Flush();
            Driver.Quit();
            _webDriver.Quit();
            HtmlReporter.Stop();

            using (var sw = new StreamWriter(ExtentFileName, true))
            {
                sw.WriteLine("<style>img {border: 1px solid #ddd;border-radius: 4px;padding: 5px;width: 150px;} img:hover {box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);}</style><script>function OpenImage(src){ var newTab = window.open(); newTab.document.body.innerHTML = " + '"' + "<img src=" + '"' + " + src + " + '"' + ">" + '"' + ";}</script>");
                sw.Close();
            }

            Extent       = null;
            HtmlReporter = null;
            Test         = null;
            Loger        = null;
            GC.Collect();
            GC.WaitForPendingFinalizers();
            ExecuteCmd("taskkill /im chromedriver.exe /f /t");
            TestContext.AddResultFile(ExtentFileName);
        }
コード例 #3
0
ファイル: Base.cs プロジェクト: ameduza/Selenium3Course
 public void Stop()
 {
     if (_driver != null)
     {
         _driver.Quit();
     }
 }
コード例 #4
0
 public void Quit()
 {
     driver.Close();
     driver.Quit();
     driver.Dispose();
     driver = null;
 }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: keehyun2/WpfApp1
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DriverControl        dc          = new DriverControl();
            EventFiringWebDriver eventDriver = dc.GetDriver(); // 드라이버 객체 생성 및 클릭 이벤트 세팅

            eventDriver.Navigate().GoToUrl("https://spib.wooribank.com/pib/Dream?withyou=CMLGN0001");
            Thread.Sleep(1000);

            Thread.Sleep(1000);
            BringToFront();
            MessageBox.Show("로그인 해주세요.");
            Thread.Sleep(1000);

            // 로그인 될때까지 대기
            while (true)
            {
                try
                {
                    if (eventDriver.FindElement(By.CssSelector(".login-name")).Displayed)
                    {
                        System.Console.WriteLine("로그인 성공");
                        break;
                    }
                }
                catch (Exception)
                {
                    //Console.WriteLine($": '{e}'");
                }
                Thread.Sleep(2000);
            }

            blindDriver = dc.GetDriver(new String[] { "--headless", "window-size=1920x1080", "disable-gpu", "user - agent = Mozilla / 5.0(Macintosh; Intel Mac OS X 10_12_6) AppleWebKit / 537.36(KHTML, like Gecko) Chrome / 61.0.3163.100 Safari / 537.36", "lang =ko_KR" });
            // blindDriver = dc.GetDriver();

            blindDriver.Navigate().GoToUrl("https://www.wooribank.com/");

            ReadOnlyCollection <Cookie> _cookies = eventDriver.Manage().Cookies.AllCookies;

            eventDriver.ExecuteScript("$('body').append('<div id=\"k-shield\" style=\"position: fixed; color: white; width: 100%;height: 100%;background: rgba(255, 0, 0, 0.6);top: 0;text-align: center; padding-top:250px; font-size: 30px; font-weight: bold; z-index: 1000;\" >기다려주세요</div>');");

            foreach (Cookie item in _cookies)
            {
                blindDriver.Manage().Cookies.AddCookie(item);
            }
            Thread.Sleep(1000);
            blindDriver.Navigate().GoToUrl("https://spib.wooribank.com/pib/Dream?withyou=PSINQ0013"); // 게좌 화면
            Thread.Sleep(1000);
            eventDriver.Quit();

            AccountList.ItemsSource = dc.SetAccountList(blindDriver);

            BringToFront();

            MessageBox.Show("계좌를 클릭해주세요.");
        }
コード例 #6
0
        public void AdminGoodsBrowserLogTest()
        {
            Start();

            GetBrowserLogs();

            GoodsClick();


            _driver.Quit();
        }
コード例 #7
0
ファイル: MSP.cs プロジェクト: RakiMohan/LSFramework
 public void CloseBrowser()
 {
     if (this._driverMSP != null)
     {
         _driverMSP.Quit();
         LogHandler.Instance.LogStep(ConfigurationManager.AppSettings["MSP_Browser"].ToString() + " Instance for MSP is Closed");
     }
     else
     {
         LogHandler.Instance.LogStep(ConfigurationManager.AppSettings["MSP_Browser"].ToString() + " Instance for MSP is Not Initialised in the current run");
     }
 }
コード例 #8
0
 public void CloseBrowser()
 {
     if (this._driverClient != null)
     {
         _driverClient.Quit();
         LogHandler.Instance.LogStep(ConfigurationManager.AppSettings["Client_Browser"].ToString() + " Instance for Client User is Closed");
     }
     else
     {
         LogHandler.Instance.LogStep("Client Browser:- " + ConfigurationManager.AppSettings["Client_Browser"].ToString() + "- Is Not Initialised in the current run");
     }
 }
コード例 #9
0
        public void SomeTestMethod1InListeners()
        {
            webDriver = new ChromeDriver();
            EventFiringWebDriver driver = new EventFiringWebDriver(webDriver);

            //driver.ElementClicked += new EventHandler<WebElementEventArgs>(firingDriver_ElementClicked);

            driver.Manage().Window.Maximize();
            driver.Manage().Cookies.DeleteAllCookies();
            driver.Url = "http://executeautomation.com/demosite/index.html?UserName=fdgf&Password=dfgdfg&Login=Login";
            driver.FindElement(By.Name("UserName")).SendKeys("Rupesh");
            driver.Close();
            driver.Quit();
        }
        public void Dispose()
        {
            if (TestStatusResult == true)
            {
                File.WriteAllText(Report, File.ReadAllText(Report).Replace("@OUTCOME", "green"));
            }
            else
            {
                File.WriteAllText(Report, File.ReadAllText(Report).Replace("@OUTCOME", "red"));
            }

            try { using (StreamWriter sw = new StreamWriter(Report, true)) { sw.WriteLine($"<center><hr/><h4>Última Tela Apresentada</h4><img style='width:50%;height:50%;' src='data:image/png; base64, {WebDriver.GetScreenshot().AsBase64EncodedString}'/></center><hr/>"); } } catch { }

            try { driver.Quit(); } catch { }

            try { WebDriver.Quit(); } catch { }


            _output.WriteLine($"Result Teste: {Report}");
        }
コード例 #11
0
ファイル: BaseTest.cs プロジェクト: moacirjunior88/Send4
        public void Cleanup()
        {
            if (TestContext.CurrentContext.Result.Outcome.Equals(ResultState.Success))
            {
                LogSucessoEAddPrint(true, statuScenario);
            }
            else
            {
                LogSucessoEAddPrint(false, statuScenario);
            }

            webDriver.Quit();
            driver.Quit();
            ExtentReport.extent.Flush();

            ExecuteCMD("taskkill /im chromedriver.exe /f /t");
            ExecuteCMD("taskkill /im chrome.exe /f /t");

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
コード例 #12
0
 public void Quit()
 {
     if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed)
     {
         var fileName = TestContext.CurrentContext.TestDirectory + "\\" +
                        DateTime.Now.ToString("yy-MM-dd-HH-mm-ss-FFF") + "-" + GetType().Name + "-" +
                        TestContext.CurrentContext.Test.FullName + "." + ScreenshotImageFormat.Jpeg;
         try
         {
             ((ITakesScreenshot)driver).GetScreenshot().SaveAsFile(fileName, ScreenshotImageFormat.Jpeg);
             TestContext.AddTestAttachment(fileName);
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
         }
     }
     driver.Close();
     driver.Quit();
     driver.Dispose();
     driver = null;
 }
コード例 #13
0
 public void Stop()
 {
     driver.Quit();
     driver = null;
 }
コード例 #14
0
 public void TearDown()
 {
     driver.Quit();
     driver = null;
 }
コード例 #15
0
 public void quit()
 {
     driver.Quit();
 }
コード例 #16
0
 public void Cleanup()
 {
     driver.Quit();
     driver.Dispose();
 }