Пример #1
0
        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("계좌를 클릭해주세요.");
        }
        public void InitializeFront()
        {
            TestResultsDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestResults", DateTime.Now.ToString("dd-MM-yyyy hh_mm_ss"));

            ExtentFileName = Path.Combine(TestResultsDirectory, TestContext.TestName + '_' + DateTime.Now.ToString("ddMMyyyy_hhmmss") + ".html");

            if (!Directory.Exists(TestResultsDirectory))
            {
                Directory.CreateDirectory(TestResultsDirectory);
            }

            if (!File.Exists(ExtentFileName))
            {
                File.Create(ExtentFileName);
            }

            HtmlReporter = new ExtentHtmlReporter(ExtentFileName);
            Extent       = new ExtentReports();
            Extent.AttachReporter(HtmlReporter);

            Test = Extent.CreateTest(TestContext.TestName + " " + Title, Description);

            GetDriverBrowser();
            Driver = new EventFiringWebDriver(_webDriver);
            Action = new Actions(Driver);
            SetEnviornment();
            Driver.Manage().Window.Position = new System.Drawing.Point(1000, 0);
            Driver.Navigate().GoToUrl(Url);
            Driver.Manage().Window.Maximize();

            Driver.ElementValueChanged += FiringDriver_ElementValueChanged;
            Driver.ElementClicked      += Driver_ElementClicked;
        }
Пример #3
0
        public void MyTestInitialize()
        {
            SetEnviornment();
            Driver.Navigate().GoToUrl(Url);
            Driver.Manage().Window.Maximize();

            TestResultsDirectory = TestContext.TestResultsDirectory;

            ExtentFileName = Path.Combine(TestResultsDirectory, TestContext.TestName + '_' + DateTime.Now.ToString("ddMMyyyy_hhmmss") + ".html");

            if (!Directory.Exists(TestResultsDirectory))
            {
                Directory.CreateDirectory(TestResultsDirectory);
            }

            if (!File.Exists(ExtentFileName))
            {
                File.Create(ExtentFileName);
            }

            Playback.PlaybackError += Playback_PlaybackError;
            HtmlReporter            = new ExtentHtmlReporter(ExtentFileName);
            Extent = new ExtentReports();
            Extent.AttachReporter(HtmlReporter);

            Test = Extent.CreateTest(TestContext.TestName + " " + Title, Description);

            Driver.ElementValueChanged += FiringDriver_ElementValueChanged;
            Driver.ElementClicked      += Driver_ElementClicked;
        }
        public void Can_Add_Comment()
        {
            DatabaseHelper.ExecuteCommand("DELETE FROM Messages");
            DatabaseHelper.ExecuteCommand("INSERT INTO Messages (Message) VALUES('foo'),('Bar')");
            using (var driver = new EventFiringWebDriver(new ChromeDriver()))
            {
                driver.Navigate().GoToUrl("http://localhost/TDDDemoApp/");

                var loadingWait = new WebDriverWait(driver, new TimeSpan(0, 0, 30));
                loadingWait.Until(x => !x.FindElement(By.Id("message-loading")).Displayed);

                const string inputMessage = "this is my message";
                var          inputElement = driver.FindElement(By.Id("message-text-input"));
                inputElement.SendKeys(inputMessage);

                var buttonElement = driver.FindElement(By.Id("add-message-button"));
                buttonElement.Click();

                var wait = new WebDriverWait(driver, new TimeSpan(0, 0, 5));
                wait.Until(x => string.IsNullOrEmpty(x.FindElement(By.Id("message-text-input")).Text));

                Thread.Sleep(1000);

                var messages = driver.FindElements(By.TagName("blockquote"));
                Assert.That(messages.Any(x => x.Text.Contains(inputMessage)));
            }
        }
Пример #5
0
        public void FirstTestEvent()
        {
            driver.Navigate().GoToUrl("http://www.google.ru/");

            driver.FindElement(By.Id("lst-ib")).SendKeys("software-testing.ru");
            driver.FindElement(By.Id("lst-ib")).SendKeys(Keys.Enter);
        }
Пример #6
0
        public void Setup()
        {
            statuScenario = new LogStatus();

            if (contadorExtentResports == 0)
            {
                ExtentReport.CreateFileLog();
                contadorExtentResports += 1;
            }
            else
            {
                contadorExtentResports += 1;
            }

            ExecuteCMD("taskkill /im chromedriver.exe /f /t");
            ExecuteCMD("taskkill /im chrome.exe /f /t");
            webDriver = new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory);

            driver = new EventFiringWebDriver(webDriver);
            driver.ElementClicking      += DriverElementClicking;
            driver.ElementClicked       += DriverElementClicked;
            driver.ElementValueChanging += DriverElementValueChanging;
            driver.ElementValueChanged  += DriverElementValueChanged;

            action = new Actions(driver);

            driver.Navigate().GoToUrl(Url);

            driver.Manage().Window.Maximize();

            action = new Actions(driver);
        }
Пример #7
0
        // [Test]
        public void test1()
        {
            sendMail smail = new sendMail();

            eventDriver = new EventFiringWebDriver(_driver);
            eventDriver.ElementClicked += new EventHandler <WebElementEventArgs> (OnElementClick);
            eventDriver.Navigated      += new EventHandler <WebDriverNavigationEventArgs>(OnNavigated);

            eventDriver.Navigate().GoToUrl("https://google.com");
        }
Пример #8
0
        public OMNIPlugin OpenWebProcess(string url)
        {
            _log.Info("Passo OpenOmni Process....");

            _driverEvent.Navigate().GoToUrl(url);

            //SetDialogRPA();

            _log.Info("Passo OpenOmni ....OK");

            return(this);
        }
        public void Home_Page_Shows_Existing_Messages()
        {
            DatabaseHelper.ExecuteCommand("DELETE FROM Messages");
            DatabaseHelper.ExecuteCommand("INSERT INTO Messages (Message) VALUES('foo'),('Bar')");

            using (var driver = new EventFiringWebDriver(new ChromeDriver()))
            {
                driver.Navigate().GoToUrl("http://localhost/TDDDemoApp/");

                var wait = new WebDriverWait(driver, new TimeSpan(0, 0, 30));
                wait.Until(x => !x.FindElement(By.Id("message-loading")).Displayed);

                var messages = driver.FindElements(By.TagName("blockquote"));
                Assert.That(messages.Count, Is.EqualTo(2));

                Thread.Sleep(2000);
            }
        }
        public void TheBaiduSwitchWindowTest()
        {
            //IWebDriver driver = new ChromeDriver();//谷歌浏览器
            IWebDriver driver = new EventFiringWebDriver(new ChromeDriver());



            driver.Navigate().GoToUrl("http://tieba.baidu.com/f/search/adv");

            //找到注册元素
            IWebElement register = driver.FindElement(By.CssSelector("#com_userbar>ul>li:nth-child(5)>div>a"));

            register.Click();

            //显示所有标识
            IList <string> listHand = driver.WindowHandles;//拿到所有标识

            //切换到注册窗口再输入12345
            driver.SwitchTo().Window(listHand[1]);
            driver.FindElement(By.Name("userName")).SendKeys("12345");
        }
Пример #11
0
        public void RunCatalog()
        {
            IList <IWebElement> rowItems = driver.FindElements(By.CssSelector("tr.row"));
            bool closeFolderIsPresent;
            int  rowIndex    = 0;
            int  folderIndex = 0;

            do
            {
                closeFolderIsPresent = false;
                do
                {
                    if (rowItems[rowIndex].FindElements(By.CssSelector("i.fa-folder")).Count > 0)
                    {
                        rowItems[rowIndex].FindElement(By.CssSelector("td:nth-child(3) > a")).Click();
                        closeFolderIsPresent = true;
                        rowIndex             = folderIndex++;
                    }
                    else if (rowItems[rowIndex].FindElements(By.CssSelector("td:nth-child(3) > img")).Count > 0)
                    {
                        rowItems[rowIndex].FindElement(By.CssSelector("td:nth-child(3) > a")).Click();
                        wait.Until(ExpectedConditions.TitleContains("Edit Product:"));
                        GetBrowserLogs("Product page : ");
                        //GetPerformanceLogs("Product page : ");

                        driver.Navigate().Back();
                        WaitPage("Catalog | My Store");

                        GetBrowserLogs("Catalog page : ");
                        //GetPerformanceLogs("Catalog page : ");
                        rowIndex++;
                    }
                    else
                    {
                        rowIndex++;
                    }
                    rowItems = driver.FindElements(By.CssSelector("tr.row"));
                } while (!closeFolderIsPresent && (rowIndex < rowItems.Count));
            } while (closeFolderIsPresent);
        }
Пример #12
0
        // 계좌 선택
        private void AccountList_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            blindDriver.Navigate().GoToUrl("https://spib.wooribank.com/pib/Dream?withyou=PSINQ0028"); // 상세조회 화면
            Thread.Sleep(1000);
            blindDriver.ExecuteScript("beforeAddDate('4');");

            try
            {
                while (blindDriver.FindElement(By.CssSelector(".pop-content")).Displayed)
                {
                    Thread.Sleep(1000);
                }
            }
            catch (Exception)
            {
                Console.WriteLine("조회중");
            }

            List <PayVO> list = new List <PayVO>();

            IReadOnlyCollection <IWebElement> elList = blindDriver.FindElements(By.CssSelector(".gridHeaderTableDefault .grid_body_row"));

            foreach (IWebElement el in elList)
            {
                PayVO payVO = new PayVO();
                payVO.No      = el.FindElement(By.CssSelector("td:nth-child(1)")).Text;
                payVO.PayDt   = el.FindElement(By.CssSelector("td:nth-child(2)")).Text;
                payVO.Briefs  = el.FindElement(By.CssSelector("td:nth-child(3)")).Text;
                payVO.Memo    = el.FindElement(By.CssSelector("td:nth-child(4)")).Text;
                payVO.OutAmt  = el.FindElement(By.CssSelector("td:nth-child(5)")).Text;
                payVO.InAmt   = el.FindElement(By.CssSelector("td:nth-child(6)")).Text;
                payVO.Balance = el.FindElement(By.CssSelector("td:nth-child(7)")).Text;
                payVO.Point   = el.FindElement(By.CssSelector("td:nth-child(8)")).Text;

                list.Add(payVO);
            }

            PayList.ItemsSource = list;
        }