public void GoToUrlSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\automation-env\web-drivers"
            }).Get();

            driver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net");
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void GoToUrlRemoteSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"http://localhost:4444/wd/hub", Source = "remote"
            }).Get();

            driver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net");
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void ActionSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = CHROME, Binaries = DRIVER_PATH
            }).Get();

            driver.GoToUrl(URL);
            driver.GetElement(By.XPath("//a[.='Students']")).Actions().Click().Build().Perform();
            driver.Dispose();
        }
        public void ForcedClickSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = CHROME, Binaries = DRIVER_PATH
            }).Get();

            driver.GoToUrl(URL);
            driver.GetElement(By.XPath("//a[.='Students']")).ForceClick();
            driver.Dispose();
        }
        public void VerticalWindowScrollSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = CHROME, Binaries = DRIVER_PATH
            }).Get();

            driver.GoToUrl(URL);
            driver.Manage().Window.Size = new Size(100, 500);
            driver.VerticalWindowScroll(200);
            driver.Dispose();
        }
        public void GetEnabledElements()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = CHROME, Binaries = DRIVER_PATH
            }).Get();

            driver.GoToUrl(URL);
            driver.GetVisibleElements(By.XPath("//a[.='Students']"));
            //driver.GetVisibleElements(By.XPath("//a[.='Students']"), TimeSpan.FromSeconds(20));
            driver.Dispose();
        }
示例#7
0
        public void GoToUrlTest()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"D:\automation-env\web-drivers"
            }).Get();

            driver.GoToUrl("https://www.way2automation.com/");

            Thread.Sleep(1000);
            driver.Dispose();
        }
        public void SendKeysIntervalSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = TestBinaryPath
            }).Get();

            driver.Navigate().GoToUrl("https://gravitymvctestapplication.azurewebsites.net/Student");
            driver.GetEnabledElement(By.XPath("//input[@id='SearchString']")).SendKeys("hello", 1000);
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void ActionsSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = TestBinaryPath
            }).Get();

            driver.Navigate().GoToUrl("https://gravitymvctestapplication.azurewebsites.net/");
            driver.GetVisibleElement(By.XPath("//a[.='Students']")).Actions().Click().Build().Perform();
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void GetVisibleElementSample() //Clicks only if the element is visible (GetElement could try to click an existing but not visible element which will cause an exception)
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\automation-env\web-drivers"
            }).Get();

            driver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net");
            driver.GetVisibleElement(By.XPath("//a[.='Students']")).Click();
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void ActionsSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\automation-env\web-drivers"
            }).Get();

            driver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net");
            driver.GetVisibleElement(By.XPath("//a[.='Students']")).Actions().Click().Build().Perform(); //Last point will be the element itself because we moved to it inside Actions method.
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void WebDriverFactorySimpleFireFoxForceClick()
        {
            var _webDriver = new WebDriverFactory(new DriverParams {
                Driver = "FIREFOX", Binaries = @"C:\Users\dori\Documents\VsDorProject\AutomationRoot\Automation.Testing\bin\Debug\net4.8\Firefox\0.29.0\X64"
            }).Get();

            _webDriver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/");
            _webDriver.GetElement(By.XPath("(//a[@class='nav-link text-dark'])[2]")).ForceClick();

            _webDriver.Dispose();
        }
        public void ForceClearSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\automation-env\web-drivers"
            }).Get();

            driver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/Student");
            driver.GetEnabledElement(By.XPath("//input[@id='SearchString']")).SendKeys("Hello", 0).SendKeys(Keys.Home, 0).ForceClear();
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void ForceClickSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\automation-env\web-drivers"
            }).Get();

            driver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net");
            driver.GetVisibleElement(By.XPath("//a[.='Students']")).ForceClick();
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void WebDriverFactorySimpleFireFoxForceClear()
        {
            var _webDriver = new WebDriverFactory(new DriverParams {
                Driver = "FIREFOX", Binaries = @"C:\Users\dori\Documents\VsDorProject\AutomationRoot\Automation.Testing\bin\Debug\net4.8\Firefox\0.29.0\X64"
            }).Get();

            _webDriver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/Student");
            _webDriver.GetElement(By.XPath("//input[@id='SearchString']")).SendKeys("Doe", 1000).ForceClear();

            _webDriver.Dispose();
        }
示例#16
0
        public void SendKeysWithInterval()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = CHROME, Binaries = DRIVER_PATH
            }).Get();

            driver.GoToUrl(URL);
            driver.GetElement(By.XPath("//a[.='Students']")).Click();
            driver.GetEnabledElement(By.XPath("//input[@id='SearchString']")).SendKeys("Hello Its a test ", 100);
            driver.Dispose();
        }
        public void WebDriverFactorySimpleChromeSumbitFormRemoteFireFox()
        {
            var _webDriver = new WebDriverFactory(new DriverParams {
                Driver = "FIREFOX", Binaries = @"http://172.19.0.6:5555", Source = "REMOTE"
            }).Get();

            _webDriver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/Student");
            _webDriver.GetElement(By.XPath("//input[@id='SearchString']")).SendKeys("Alexander");
            _webDriver.SumbitFrom(0);

            _webDriver.Dispose();
        }
        public void VerticalWindowScrollSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = TestBinaryPath
            }).Get();

            driver.Navigate().GoToUrl("https://gravitymvctestapplication.azurewebsites.net/Student");
            driver.Manage().Window.Size = new Size(100, 350);
            driver.VerticalWindowScroll(1000);
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void WebDriverFactorySimpleFireFoxScrollWindow()
        {
            var _webDriver = new WebDriverFactory(new DriverParams {
                Driver = "FIREFOX", Binaries = @"C:\Users\dori\Documents\VsDorProject\AutomationRoot\Automation.Testing\bin\Debug\net4.8\Firefox\0.29.0\X64"
            }).Get();


            _webDriver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/Student");
            _webDriver.Manage().Window.Size = new Size(100, 350);
            _webDriver.VerticalWindowScroll(1000);
            _webDriver.Dispose();
        }
示例#20
0
        public void GetEnabledElement()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = CHROME, Binaries = DRIVER_PATH
            }).Get();

            driver.GoToUrl(URL);
            driver.GetElement(By.XPath("//a[.='Students']")).Click();
            driver.GetEnabledElement(By.XPath("//input[@id='SearchString']")).SendKeys("Hello Its a test ");
            //driver.GetEnabledElements(By.XPath("//a[.='Students']"), TimeSpan.FromSeconds(20));
            driver.Dispose();
        }
        public void VerticalWindowScrollSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\automation-env\web-drivers"
            }).Get();

            driver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/Student");
            driver.Manage().Window.Size = new Size(100, 350);
            driver.VerticalWindowScroll(1000); //Scroll to point 1000 ( not 1000 pixels )
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void AsSelectSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\automation-env\web-drivers"
            }).Get();

            driver.Manage().Window.Maximize();
            driver.Navigate().GoToUrl("https://gravitymvctestapplication.azurewebsites.net/Course");
            driver.FindElement(By.XPath("//select[@id='SelectedDepartment']")).AsSelect().SelectByValue("4");
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void GetVisibleElementsSample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = TestBinaryPath
            }).Get();

            driver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/");
            var elements = driver.GetVisibleElements(By.XPath("//ul/li"));

            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void WebDriverFactorySample()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\automation-env\web-drivers"
            }).Get();

            driver.Manage().Window.Maximize();
            driver.Navigate().GoToUrl("https://gravitymvctestapplication.azurewebsites.net");
            driver.FindElement(By.XPath("//a[.='Students']")).Click();
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void GetElementSample() //GetElement is Extension method we created in order to have the capability to wait for an element to appear
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\automation-env\web-drivers"
            }).Get();

            driver.Manage().Window.Maximize();
            driver.Navigate().GoToUrl("https://gravitymvctestapplication.azurewebsites.net");
            driver.GetElement(By.XPath("//a[.='Students']")).Click();
            Thread.Sleep(2000);
            driver.Dispose();
        }
示例#26
0
        public void GetVisibleElementsTest()
        {
            var driver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"D:\automation-env\web-drivers"
            }).Get();

            driver.GoToUrl("https://www.way2automation.com/");

            var elements = driver.GetVisibleElements(By.XPath("//ul/li"));

            Thread.Sleep(1000);
            driver.Dispose();
        }
        public void GoToUrlSampleFw()
        {
            var driver = new WebDriverFactory(new DriverParams
            {
                Driver = "chrome", Binaries = @"C:\tools"
            })
                         .Get()
                         .GoToUrl("https://gravitymvctestapplication.azurewebsites.net/");

            driver.FindElement(By.XPath("//a[contains(.,'Students')]")).Click();
            Thread.Sleep(2000);
            driver.Dispose();
        }
        public void WebDriverFactorySimpleFireFoxVisibleElement()
        {
            var _webDriver = new WebDriverFactory(new DriverParams {
                Driver = "FIREFOX", Binaries = @"C:\Users\dori\Documents\VsDorProject\AutomationRoot\Automation.Testing\bin\Debug\net4.8\Firefox\0.29.0\X64"
            }).Get();


            _webDriver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/");
            _webDriver.GetVisibleElement(By.XPath("(//a[@class='nav-link text-dark'])[2]")).Click();
            Assert.IsTrue(_webDriver.Title.Contains("Student Body Statistics - Contoso University"));

            _webDriver.Dispose();
        }
        public void WebDriverFactorySimpleChrome()
        {
            var _webDriver = new WebDriverFactory(new DriverParams {
                Driver = "chrome", Binaries = @"C:\Users\DorIngber\OneDrive - pango\שחזור\שחזזור2\VsDorProject\AutomationRoot\Automation.Testing\bin\Debug\net4.8\Chrome\90.0.4430.24\X64\"
            }).Get();


            _webDriver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/");
            _webDriver.GetElement(By.XPath("(//a[@class='nav-link text-dark'])[2]")).Click();
            Assert.IsTrue(_webDriver.Title.Contains("Student Body Statistics - Contoso University"));

            _webDriver.Dispose();
        }
        public void WebDriverFactorySimpleChromeWithoutBinaries()
        {
            var _webDriver = new WebDriverFactory(new DriverParams {
                Driver = "chrome"
            }).Get();


            _webDriver.GoToUrl("https://gravitymvctestapplication.azurewebsites.net/");
            _webDriver.GetElement(By.XPath("(//a[@class='nav-link text-dark'])[2]")).Click();
            Assert.IsTrue(_webDriver.Title.Contains("Student Body Statistics - Contoso University"));

            _webDriver.Dispose();
        }