public void RegistrationAlreadyHaveAccountLinkWorks()
        {
            _chrome.Navigate().GoToUrl("http://localhost:5000/UserRegistration/Register");
            _chrome.FindElementByLinkText("Already have an account?").Click();
            Assert.Contains("Login", _chrome.FindElementById("Login").Text);

            _chrome.Close();
        }
Пример #2
0
        private void Login()
        {
            //nav-signin-tooltip
            driver.Navigate().GoToUrl(AmazonBaseUrl);

            try
            {
                driver.FindElementByLinkText("Start here.");
            }
            catch (Exception e)
            {
                LoggedIn = true;
                return;
            }

            //TODO: Need another check for already loogined in
            var toggleButton = driver.FindElementById("nav-signin-tooltip");
            var link         = toggleButton.FindElement(By.TagName("a"));

            link.Click();

            var form = driver.FindElementByName("signIn");

            var inputs = form.FindElements(By.TagName("input"));

            List <string> ids = new List <string>();

            foreach (var input in inputs)
            {
                string name = input.GetAttribute("name");

                switch (name)
                {
                case "email":
                    input.Click();
                    input.SendKeys(AppContext.Settings.Username);
                    break;

                case "password":
                    input.Click();
                    input.SendKeys(AppContext.Settings.Password);
                    break;

                case "rememberMe":
                    input.Click();
                    break;
                }
                ids.Add(name);
            }

            var signInButton = form.FindElement(By.Id("signInSubmit"));

            signInButton.Click();

            LoggedIn = true;
        }
Пример #3
0
        static void Main(string[] args)
        {
            using (var driver = new ChromeDriver())
            {
                driver.Navigate().GoToUrl("https://orteil.dashnet.org/cookieclicker/");
                Thread.Sleep(5000);
                driver.FindElementById("prefsButton").Click();
                Thread.Sleep(1000);
                driver.FindElementByLinkText("Import save").Click();
                var saveFile = File.ReadAllText("CookieSave.txt");
                driver.FindElementById("textareaPrompt").SendKeys(saveFile);
                driver.FindElementById("promptOption0").Click();
                var numOfLoops = 0;
                while (true)
                {
                    if (numOfLoops == 100)
                    {
                        try
                        {
                            driver.FindElementById("prefsButton").Click();
                            Thread.Sleep(1000);
                            driver.FindElementByLinkText("Export save").Click();
                            var save = driver.FindElementById("textareaPrompt").Text;
                            File.WriteAllText("CookieSave.txt", save);
                            driver.FindElementById("promptOption0").Click();
                            numOfLoops = 0;
                        }
                        catch
                        {
                            continue;
                        }
                    }

                    try
                    {
                        driver.FindElementById("bigCookie").Click();
                    }
                    catch
                    {
                        break;
                    }
                    var productNum       = new Random().Next(10);
                    var productElementId = "product" + productNum;
                    try
                    {
                        driver.FindElementById(productElementId).Click();
                    }
                    catch
                    {
                        continue;
                    }

                    numOfLoops++;
                }
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            ChromeDriver myBrowser = new ChromeDriver();

            //****************************************************************************
            myBrowser.Navigate().GoToUrl("http://www.hwpl.org/databases/");
            myBrowser.FindElementByLinkText("ABI/INFORM Complete").Click();

            myBrowser.FindElementById("barcode").SendKeys("21327001023680");
            myBrowser.FindElementById("barcodeSubmit").Click();
            var searchPageUrl = myBrowser.Url;

            myBrowser.FindElementById("searchTerm").SendKeys("(907) 225-1494");
            myBrowser.FindElementById("expandedSearch").Click();
            var  items = myBrowser.FindElementByClassName("resultItems").FindElements(By.TagName("li"));
            bool found = false;

            foreach (var item in items)
            {
                var sourceItems = item.FindElement(By.ClassName("item")).FindElements(By.ClassName("titleAuthorETC"));
                foreach (var scrItem in sourceItems)
                {
                    if (scrItem.Text.Contains("Experian Commercial Risk Database"))
                    {
                        found = true;
                        break;
                    }
                }
                if (found)
                {
                    item.FindElement(By.TagName("h3")).FindElement(By.TagName("a")).Click();
                    break;
                }
            }
            if (!found)
            {
                myBrowser.Navigate().GoToUrl(searchPageUrl);
            }
            while (myBrowser.FindElementsById("emailLink").Count == 0)
            {
                Thread.Sleep(500);
            }
            Thread.Sleep(1000);
            myBrowser.FindElementById("emailLink").Click();
            while (myBrowser.FindElementsByClassName("emailBccTextField").Count == 0)
            {
                Thread.Sleep(500);
            }
            Thread.Sleep(1000);
            myBrowser.FindElementByClassName("emailBccTextField").FindElement(By.TagName("input")).SendKeys("*****@*****.**");
            myBrowser.FindElementByClassName("clsEmlUsrNm").SendKeys("Danyal");
            myBrowser.FindElementByLinkText("Continue").Click();
            Thread.Sleep(1000);
            myBrowser.Navigate().GoToUrl(searchPageUrl);
        }
Пример #5
0
        private string GetDescription()
        {
            var element = _browser.FindElementByLinkText("Show Kata Description");

            element.Click();
            //wait the animation
            Thread.Sleep(2000);

            element = _browser.FindElementById("description");
            return(element.Text);
        }
        public void NavigateToPage()
        {
            var username = user;
            var password = pass;

            _chrome.Navigate().GoToUrl("http://localhost:5000/Authentication/Login");
            _chrome.FindElementById("Username").SendKeys(username);
            _chrome.FindElementById("Password").SendKeys(password);
            _chrome.FindElementById("Login").Click();
            Assert.Contains(username.ToLower(), _chrome.FindElementById("DashboardMsg").Text.ToLower());
            _chrome.FindElementByLinkText("Register Demographics").Click();
            Assert.Contains("Voter Demographics", _chrome.FindElementByClassName("form-signin-heading").Text);
            _chrome.Close();
        }
        public void NavigateToPage()
        {
            var username = user;
            var password = pass;

            _chrome.Navigate().GoToUrl("http://localhost:5000/Authentication/Login");
            _chrome.FindElementById("Username").SendKeys(username);
            _chrome.FindElementById("Password").SendKeys(password);
            _chrome.FindElementById("Login").Click();
            Assert.Contains(username.ToLower(), _chrome.FindElementById("DashboardMsg").Text.ToLower());
            _chrome.FindElementByLinkText("Profile").Click();
            Assert.Contains("User Profile", _chrome.FindElementById("Profile").Text);

            _chrome.Close();
        }
Пример #8
0
        public void CreatingNewIssueSavesCorrectly()
        {
            var data = new
            {
                Title       = "Issue",
                Description = "Fix all the bugs",
                Status      = IssueStatus.Done
            };

            using (var driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            {
                driver.Navigate().GoToUrl(@"https://*****:*****@"https://localhost:5000/Issue/Create", driver.Url);
                var titleInput = driver.FindElementById("Title");
                titleInput.SendKeys(data.Title);
                var descriptionInput = driver.FindElementById("Description");
                descriptionInput.SendKeys(data.Description);
                var statusSelect  = driver.FindElementById("Status");
                var selectElement = new SelectElement(statusSelect);
                selectElement.SelectByValue($"{(int)data.Status}");
                var createButton = driver.FindElementByCssSelector("input.btn.btn-default");
                Assert.Equal("Create", createButton.GetAttribute("value"));
                createButton.Click();
                Assert.Equal(@"https://localhost:5000/Issue", driver.Url);
                var savedtitleInput = driver.FindElementById("Title");
                savedtitleInput.SendKeys(data.Title);
            }
        }
Пример #9
0
        public void GetPageByLinkText(string linkText)
        {
            _driver.SwitchTo().Window(_driver.WindowHandles[0]);
            var count = 1;

            while (_driver.FindElementByLinkText(linkText).Displayed == false)
            {
                System.Threading.Thread.Sleep(2000);
                count++;
                if (count == 10)
                {
                    break;
                }
            }
            _driver.FindElementByLinkText(linkText).Click();
        }
Пример #10
0
 public void SetUp()
 {
     driver = new ChromeDriver(service);
     driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
     driver.Url = "localhost:8080";
     driver.FindElementByLinkText("here").Click();
 }
Пример #11
0
        public void Admin_Can_Save_And_Publish()
        {
            _driver.Url = "http://localhost:56565/umbraco#/content/content/edit/1089";
            _fixture.Wait("div.workflow-button-drawer");

            Assert.Throws <NoSuchElementException>(() => _driver.FindElementByLinkText("Save and publish"));
        }
Пример #12
0
        public void NavBarClick()
        {
            using (var driver = new ChromeDriver())
            {
                driver.Manage().Window.Maximize();
                driver.Navigate().GoToUrl(websiteLink);

                Actions action = new Actions(driver);
                driver.FindElementByLinkText("About").Click();;
                var aboutTitle = driver.FindElementById("AboutTitle");

                Assert.IsNotNull(aboutTitle);
            }


            using (var driver = new FirefoxDriver())
            {
                driver.Manage().Window.Maximize();
                driver.Navigate().GoToUrl(websiteLink);

                driver.FindElementByLinkText("About").Click();;
                var aboutTitle = driver.FindElementById("AboutTitle");

                Assert.IsNotNull(aboutTitle);
            }
        }
        public void BasicSeleniumFlow()
        {
            IWebElement okConsentButton;
            IWebElement privateNavigationOption;
            IWebElement menuHeader;

            // You can find Chrome Driver here: https://sites.google.com/a/chromium.org/chromedriver/downloads
            // Pass "." as argument when creating the ChromeDriver. By doing that we will look for chromedriver.exe in the current folder.
            using (var driver = new ChromeDriver("."))
            {
                // This is a basic selenium flow, navigating the webapage of Collector Bank.
                // The flow is straight forward, no POM pattern, so the test is hard to follow. Even harder to maintain as it might grow.
                driver.Navigate().GoToUrl(collectorUrl);

                okConsentButton = driver.FindElement(By.XPath("/html/body/div[1]/div[1]/div/div[1]/div/div/button"));

                if (okConsentButton.Displayed == true)
                {
                    okConsentButton?.Click();
                }

                privateNavigationOption = driver.FindElementByLinkText("Privat");
                privateNavigationOption.Click();

                menuHeader = driver.FindElement(By.CssSelector(".hero>nav:nth-child(1) > a:nth-child(1)"));
                Assert.IsTrue(menuHeader.Text == "Privat");
            }
        }
Пример #14
0
        public void Test1()
        {
            IBitmapComparer bitmapComparer = new BitmapComparer();

            var driver = new ChromeDriver(@"Drivers/");

            //var driver = new InternetExplorerDriver(@"Drivers/");

            driver.Navigate().GoToUrl("http://www.thelondonclinic.co.uk");

            WaitForElementToAppear(driver, 2000, By.Id("patient"));

            driver.FindElement(By.Id("patient")).Click();

            WaitForElementToAppear(driver, 2000, By.LinkText("Why choose The London Clinic?"));

            driver.FindElementByLinkText("Why choose The London Clinic?").Click();

            var s = driver.GetScreenshot();

            s.SaveAsFile(@"pic.png", ImageFormat.Png);
            s.SaveAsFile(@"pic2.png", ImageFormat.Png);

            var result = bitmapComparer.AreSame(@"pic.png", @"pic2.png");

            Assert.IsTrue(result);
        }
Пример #15
0
        public void CreatingNewIssueSavesCorrectly()
        {
            var data = new
            {
                Title       = "Issue",
                Description = "Fix all the bugs",
                Status      = IssueStatus.Done
            };

            using (var driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            {
                driver.Navigate().GoToUrl(@"https://*****:*****@"https://localhost:5000/Issue/Create", driver.Url);
                var titleInput = driver.FindElementById("Title");
                titleInput.SendKeys(data.Title);
                var descriptionInput = driver.FindElementById("Description");
                descriptionInput.SendKeys(data.Description);
                var statusSelect  = driver.FindElementById("Status");
                var selectElement = new SelectElement(statusSelect);
                selectElement.SelectByValue($"{(int)data.Status}");
                var createButton = driver.FindElementByCssSelector("input.btn.btn-default");
                Assert.Equal("Create", createButton.GetAttribute("value"));
                createButton.Click();
                /* PAGE CHANGE */
                Assert.Equal(@"https://localhost:5000/Issue", driver.Url);
                var table = driver.FindElementByTagName("tbody");
                var rows  = table.FindElements(By.CssSelector("tr"));
                foreach (var row in rows)
                {
                    var columns = row.FindElements(By.TagName("td"));
                    var col1    = columns.First();
                    var col2    = columns.Skip(1).First();
                    var col3    = columns.Skip(2).First();

                    var edit         = col3.FindElement(By.CssSelector("a[href^='/Issue/Edit/']"));
                    var editHref     = edit.GetAttribute("href");
                    var editValue    = edit.Text;
                    var editIdString = editHref.Substring(editHref.LastIndexOf("/") + 1);
                    var editId       = int.Parse(editIdString);
                    if (existingIds.Contains(editId))
                    {
                        continue;
                    }

                    Assert.Equal(data.Title, col1.Text);
                    Assert.Equal(data.Description, col2.Text);
                    return;
                }
                throw new NotFoundException("Did not find new Issue in table");
            }
        }
 public bool NavigateTo(string location)
 {
     if (!Driver.Title.Contains(location))
     {
         Driver.FindElementByLinkText(location).Click();
     }
     return(Driver.Title.Contains(location));
 }
Пример #17
0
        static void Main(string[] args)
        {
            //1) Open the browser
            ChromeDriver driver = new ChromeDriver();

            //2) Maximize the browser
            driver.Manage().Window.Maximize();
            //3) Navigate to the application
            driver.Url = "https://www.barnesandnoble.com/";
            // Mouse Hover on Games & Collectibles
            IWebElement GC     = driver.FindElementByLinkText("Games & Collectibles");
            Actions     action = new Actions(driver);

            action.MoveToElement(GC).Perform();
            //Cick on "BestSeller"
            driver.FindElementByLinkText("Bestsellers").Click();
        }
        /// <summary>
        /// This method actually navigates to the Add Student page
        /// starting by launching the default page and clicking through,
        /// simulating a user on the webpage
        /// </summary>
        private void ClickThroughToAddStudentPage()
        {
            String defaultPageUrl = "http://localhost:1701/Default.aspx";

            // Launch default page
            _driver.Navigate().GoToUrl(defaultPageUrl);
            _wait.Until(d => d.FindElement(By.LinkText("Students")));

            // Hover over the "Students" button
            // See https://code.google.com/p/selenium/wiki/AdvancedUserInteractions
            var StudentButton = _driver.FindElementByLinkText("Students");

            _actionBuilder.MoveToElement(StudentButton).Build().Perform();

            // Click on the "Add Students" button
            _driver.FindElementByLinkText("Add Students").Click();
            _wait.Until(d => d.FindElement(By.Name("ctl00$MainContent$StudentsDetailsView$ctl01")));
        }
Пример #19
0
        public static void GetElementByLinkText()
        {
            ChromeDriver driver = new ChromeDriver();

            driver.Navigate().GoToUrl("https://www.belatrixsf.com/");
            IWebElement link = driver.FindElementByLinkText("SERVICES");

            link.Click();

            Console.Write($"Link text: {link.Text}");
        }
Пример #20
0
        public void GivenBasicWebsiteWhenPrivacyMenuIsSelectedThenNavigateToPrivacyPage()
        {
            // Arrange
            _driver.Navigate().GoToUrl(_config["baseSiteUrl"]);

            // Act
            _driver.FindElementByLinkText("Privacy").Click();
            TakeScreenShot("privacy");

            // Assert
            _driver.Url.Should().Be($"{_config["baseSiteUrl"]}Privacy");
        }
        public void LoginNetBanking()
        {
            driver.FindElementByCssSelector("#parentdiv > img").Click();
            //IWebElement image = driver.FindElementByCssSelector("#parentdiv > img");
            //Actions action = new Actions(driver);
            //action.Click(image).Perform();
            driver.FindElementByLinkText("LOGIN").Click();

            //Click on Continue to netbanking
            ArrayList windows = new ArrayList(driver.WindowHandles);

            driver.SwitchTo().Window(windows[1].ToString());

            //Click on NetBanking
            driver.FindElementByLinkText("CONTINUE TO NETBANKING");

            //Click on 1st "Know More" link
            driver.FindElementByLinkText("Know More").Click();

            //Click on Continue new window
            ArrayList windows1 = new ArrayList(driver.WindowHandles);

            driver.SwitchTo().Window(windows[1].ToString());

            //4) Hover over  on 'Borrow'(couldn't fine "Applynow" on the 3rd window , used Borrow instead
            IWebElement Borrow  = driver.FindElementByCssSelector("#main > div > div:nth-child(3) > div.bp-widget-body.ng-scope > div > div > div > div > div > div > div > div:nth-child(1) > div.navbar-collapse.ng-scope.collapse > ul > li:nth-child(5) > a > span.borrow-icon-large-off.menu-icon");
            Actions     actions = new Actions(driver);

            actions.MoveToElement(Borrow).Perform();

            //Click on "Personal Loan"
            driver.FindElementByCssSelector("#main > div > div:nth-child(3) > div.bp-widget-body.ng-scope > div > div > div > div > div > div > div > div:nth-child(1) > div.navbar-collapse.ng-scope.collapse > ul > li:nth-child(5) > ul > li.level-2.sub-parent.dyna-width-5.active > ul > li:nth-child(2) > a > span").Click();

            //Click "APPLY ONLINE"
            driver.FindElementByLinkText("APPLY ONLINE)").Click();

            //ENter the Mobile number 9999988888
            driver.FindElementById("txtmissing_18").SendKeys("9999988888");
        }
Пример #22
0
        public void Should_add_update_and_delete_movie()
        {
            var driver = new ChromeDriver("selenium-drivers")
            {
                Url = "http://localhost:3500"
            };

            var linkCreateMovie = driver.FindElementByLinkText("Create movie");

            linkCreateMovie.Click();

            var movieNameTextBox = driver.FindElementById("Name");

            movieNameTextBox.SendKeys("test movie");

            var addButton = driver.FindElementById("AddM");

            addButton.Click();

            var updateButton = driver.FindElementByLinkText("Update movie");

            updateButton.Click();

            movieNameTextBox = driver.FindElementById("Name");
            movieNameTextBox.SendKeys(" 2");

            var saveButton = driver.FindElementById("updateM");

            saveButton.Click();

            var deleteButton = driver.FindElementByLinkText("Delete movie");

            deleteButton.Click();

            Check.That(driver.FindElementByLinkText("Create movie").Text).IsEqualTo("Create movie");
            Check.That(driver.Url).IsEqualTo("http://localhost:3500/");

            driver.Close();
        }
Пример #23
0
        public bool ValidatePage(ChromeDriver _chrome, tipo tipo, string titulo, string text, log_navegacao log, Pessoa pessoa)
        {
            try
            {
                _chrome.Navigate().GoToUrl(log.pagina);
                log.cpf = pessoa.CPF;
                var pagenotfound = (dynamic)null;
                switch (tipo)
                {
                case tipo.ClassName:
                    pagenotfound = AjustElement.AjustExceptionsByClassName(titulo, _chrome);
                    break;

                case tipo.Id:
                    pagenotfound = AjustElement.AjustExceptionsById(titulo, _chrome);
                    break;

                case tipo.Name:
                    pagenotfound = AjustElement.AjustExceptionsByName(titulo, _chrome);
                    break;

                case tipo.TagName:
                    pagenotfound = AjustElement.AjustExceptionsByTagName(titulo, _chrome);
                    break;

                case tipo.XPath:
                    pagenotfound = AjustElement.AjustExceptionsByXPath(titulo, _chrome);
                    break;

                case tipo.CssSelector:
                    pagenotfound = _chrome.FindElementByCssSelector(titulo);
                    break;

                case tipo.LinkText:
                    pagenotfound = _chrome.FindElementByLinkText(titulo);
                    break;
                }

                if (pagenotfound.Text.Contains(text))
                {
                    log.Exception = "Página Fora do Ar:" + _chrome.Url.ToString();;
                    Error404(_chrome, pessoa, log);
                    return(false);
                }
                return(false);
            }
            catch (Exception e)
            {
                return(true);
            }
        }
Пример #24
0
        public void CreatingNewIssueSavesCorrectly()
        {
            var data = new
            {
                Title       = "Issue",
                Description = "Fix all the bugs",
                Status      = IssueStatus.Done,
            };

            using (var driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            {
                driver.Navigate().GoToUrl(@"https://*****:*****@".*/Issue/Create", driver.Url);
                var titleInput = driver.FindElementById("Title");
                titleInput.SendKeys(data.Title);
                var descriptionInput = driver.FindElementById("Description");
                descriptionInput.SendKeys(data.Description);
                var statusSelect  = driver.FindElementById("Status");
                var selectElement = new SelectElement(statusSelect);
                selectElement.SelectByValue($"{(int)IssueStatus.Done}");
                var createInput = driver.FindElementByCssSelector(".btn");
                createInput.Click();
                Assert.Equal(@"https://localhost:5000/Issue", driver.Url);
                var table = driver.FindElementByCssSelector("tbody");
                var rows  = table.FindElements(By.CssSelector("td"));
                foreach (var row in rows)
                {
                    var columns      = row.FindElements(By.TagName("td"));
                    var col1         = columns.First();
                    var col2         = columns.Skip(1).First();
                    var col3         = columns.Skip(2).First();
                    var edit         = col3.FindElement(By.CssSelector("a[href^='/Issue/Edit/']"));
                    var editIdString = edit.GetAttribute("href").Replace("/Issue/Edit/", "");
                    var editId       = int.Parse(editIdString);
                    if (!existingIds.Contains(editId))
                    {
                        continue;
                    }
                    Assert.Equal(data.Title, col1.Text);
                    Assert.Equal(data.Description, col2.Text);
                    return;
                }
                throw new NotFoundException("did not find new issue in table");
            }
        }
Пример #25
0
        public void SetRestrictions(ChromeDriver driver)
        {
            driver.FindElementById("space-menu-link").Click();
            driver.FindElementById("view-all-spaces-link").Click();
            driver.FindElementByLinkText("https://pagepage.atlassian.net/wiki/display/NEW").Click();
            //*[@id="action-menu-link"]/span/span

            driver.FindElementByXPath("*[@id='action - menu - link']/span/span").Click();
            driver.FindElementById("action - page - permissions - link").Click();

            //*[@id="recent-spaces-section"]/ul/li[1]/a
            //var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(3));
            //IWebElement regCompleted = wait.Until(drv => drv.FindElement(By.XPath("//*[contains(text(), 'Welcome to Confluence')]")));
        }
Пример #26
0
        public void CheckCheckbox()
        {
            //arrange
            var checkBox    = driver.FindElementByXPath("//*[@id=\"easycont\"]/div/div[2]/div[2]/div[2]/div[1]/label/input");
            var checkBox2   = driver.FindElementByCssSelector("#easycont > div > div.col-md-6.text-left > div:nth-child(5) > div.panel-body > div:nth-child(4) > label > input");
            var selenumLink = driver.FindElementByLinkText("Selenium Easy");

            //act
            checkBox.Click();
            checkBox2.Click();
            selenumLink.Click();
            //assert
            Assert.AreEqual("Learn Selenium with Best Practices and Examples | Selenium Easy", driver.Title);
        }
Пример #27
0
        public void ShouldTestDetailsLink()
        {
            var driver = new ChromeDriver();

            driver.Navigate().GoToUrl(testUrl);
            IWebElement element = null;

            element = driver.FindElementByLinkText("Details");

            Assert.IsNotNull(element);
            Assert.IsTrue(element is IWebElement);
            Assert.AreEqual(element.GetAttribute("href"), @"https://en.wikipedia.org/wiki/Terry_Pratchett");

            driver.Quit();
        }
        public void EndToEndTest()
        {
            ChromeDriver.Navigate().GoToUrl(GetAbsoluteUrl("/"));
            ChromeDriver.FindElementByLinkText("Log in").Click();
            ChromeDriver.FindElementById("UserName").SendKeys("admin");
            ChromeDriver.FindElementById("Password").SendKeys("!nf0suPP0r7");
            ChromeDriver.FindElementsByTagName("form")[1].Submit();
            ChromeDriver.FindElementByLinkText("Start Programmeren").Click();
            ChromeDriver.FindElementByLinkText("Start de tijd!").Click();
            ChromeDriver.FindElementByLinkText("Editor").Click();
            ChromeDriver.FindElementByLinkText("Submit").Click();
            ChromeDriver.FindElementById("assignmentSubmitModal").FindElement(By.LinkText("Submit")).Click();

            Thread.Sleep(5000);
        }
Пример #29
0
        public void ShouldTestListOfBooksLink()
        {
            var driver = new ChromeDriver();

            driver.Navigate().GoToUrl(testUrl);

            IWebElement element = null;

            element = driver.FindElementByLinkText("List of books");

            Assert.IsNotNull(element);
            Assert.IsTrue(element is IWebElement);
            Assert.AreEqual(element.GetAttribute("href"), @"https://www.terrypratchettbooks.com/books/");

            driver.Quit();
        }
Пример #30
0
        public void Pushing_All_The_Buttons_Chrome()
        {
            using (var driver = new ChromeDriver())
            {
                Actions builder = new Actions(driver);

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

                driver.Navigate().GoToUrl("https://ca-dev.gmli.bluewatertech.host");

                driver.FindElementByXPath("//*[@id='NavigationMenu']/li/a").Click();

                driver.FindElementByXPath("//*[@id='Email']").SendKeys("*****@*****.**");

                Thread.Sleep(1000);

                driver.FindElementByXPath("//*[@id='Password']").SendKeys("Droop420!");

                driver.FindElementByXPath("//*[@id='loginForm']/form/div[4]/div/input").Click();

                Thread.Sleep(2000);

                //This is the Administration tab that needs to be hovered over.
                var adminTab = driver.FindElement(By.XPath("//*[@id='NavigationMenu']/li[1]/span"));

                builder.MoveToElement(adminTab).Perform();
                //driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
                Thread.Sleep(2000);

                driver.FindElementByLinkText("Events").Click();

                Thread.Sleep(3000);

                TimeSpan      timeout = default;
                WebDriverWait wait    = new WebDriverWait(driver, timeout);

                //driver.Navigate().Refresh();


                wait.Until(ExpectedConditions.StalenessOf(adminTab));


                builder.MoveToElement(adminTab).Perform();

                Thread.Sleep(3000);
            }
        }