예제 #1
0
        public void autoTest(string browserName, int screenWidth)
        {
            driver.Navigate().GoToUrl("http://wsh1490.web-shop-hosting.com/vorfreude_result.de/index-if6.html");
            driver.Manage().Window.Size = new Size(screenWidth, 2048);

            driverWork driverWork = new driverWork(driver);

            driverWork.ScreenBuild(browserName, screenWidth, title);

            IWebElement button = driver.FindElement(By.Id("TitleCardStartButton"));

            button.Click();
            Thread.Sleep(3000);
            driverWork.ScreenBuild(browserName, screenWidth, age);
            button = driver.FindElement(By.Id("QuestionAgeWeiter"));
            button.Click();
            Thread.Sleep(3000);

            driverWork.ScreenBuild(browserName, screenWidth, question1);
            button = driver.FindElement(By.Id("QuestionFormWeiter"));
            //<a id="QuestionFormWeiter" href="#">Weiter</a>
            button.Click();

            Thread.Sleep(3000);
            //button = driver.FindElement(By.TagName("span")).FindElement(By.LinkText("+"));
            button = driver.FindElement(By.XPath("/html/body/section/div[3]/div/div[2]/div[2]/div[2]/table/tbody/tr/td[3]/span"));

            button.Click();
            button.Click();
            Thread.Sleep(2000);
            driverWork.ScreenBuild(browserName, screenWidth, question2);
            button = driver.FindElement(By.Id("QuestionFormWeiter"));
            button.Click();

            Thread.Sleep(3000);
            button = driver.FindElement(By.XPath("/html/body/section/div[3]/div/div[2]/div[2]/div[3]/table/tbody/tr/td[3]/span"));
            button.Click();
            button.Click();
            button.Click();
            button.Click();
            Thread.Sleep(3000);
            driverWork.ScreenBuild(browserName, screenWidth, question3);
            button = driver.FindElement(By.Id("QuestionFormWeiter"));
            button.Click();

            Thread.Sleep(3000);
            driverWork.ScreenBuild(browserName, screenWidth, final);
            button = driver.FindElement(By.XPath("/html/body/section/div[4]/div/div[5]/div/div/a"));
            button.Click();

            Thread.Sleep(3000);
            driverWork.ScreenBuild(browserName, screenWidth, finalCalculator);
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //************************* Firefox (Работает) ****************************************************
            //IWebDriver driverFirefox = new FirefoxDriver();
            //driverFirefox.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30));
            //driverFirefox.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(55));
            //driverFirefox.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(30));

            //driverWork driverFirefoxWork = new driverWork(driverFirefox);
            //driverFirefoxWork.autoTest(firefoxNameVersion, width1280);
            //driverFirefoxWork.autoTest(firefoxNameVersion, width600);
            //driverFirefoxWork.autoTest(firefoxNameVersion, width480);
            //driverFirefoxWork.autoTest(firefoxNameVersion, width320);
            //driverFirefox.Close();
            //************************* Firefox ****************************************************


            //************************* Safari 5.1.7 только на версии Selenium 2.47 *****************************************************

            /*IWebDriver driverSafari = new SafariDriver();
             * driverSafari.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30));
             * driverSafari.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(55));
             * driverSafari.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(30));
             *
             * driverWork driverSafariWork = new driverWork(driverSafari);
             * driverSafariWork.autoTest(safariNameVersion, width1280);
             * driverSafariWork.autoTest(safariNameVersion, width600);
             * driverSafariWork.autoTest(safariNameVersion, width480);
             * driverSafariWork.autoTest(safariNameVersion, width320);
             * driverSafari.Close();*/
            //************************* Safari 5.1.7 *******************************************************


            //************************* IE11 (Работает) *****************************************************
            IWebDriver driverIE = new InternetExplorerDriver();

            driverIE.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30));
            driverIE.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(55));
            driverIE.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(30));

            driverWork driverIEWork = new driverWork(driverIE);

            driverIEWork.autoTest(IENameVersion, width1280);
            driverIEWork.autoTest(IENameVersion, width600);
            driverIEWork.autoTest(IENameVersion, width480);
            driverIEWork.autoTest(IENameVersion, width320);
            driverIE.Close();
            //************************* IE11 *******************************************************



            //************************* chrome_v53 ( Работает и на 2,47) *****************************************************
            //IWebDriver driverChrome = new ChromeDriver();
            //driverChrome.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30));
            //driverChrome.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(55));
            //driverChrome.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(30));

            //driverWork driverChromeWork = new driverWork(driverChrome);
            //driverChromeWork.autoTest(chromeNameVersion, width1280);
            //driverChromeWork.autoTest(chromeNameVersion, width600);
            //driverChromeWork.autoTest(chromeNameVersion, width480);
            //driverChromeWork.autoTest(chromeNameVersion, width320);
            //driverChrome.Close();
            //************************* chrome_v53 *******************************************************
        }