public void BeAbleToAddAnItem()
        {
            // User goes to homepage of application
            driver.Navigate().GoToUrl(rootUrl);
            driver.WaitForElement(By.Id("plannerItems"));
            HelperMethods.WaitForCondition(HasLoadedUsersItems);

            // User sees a message notifying them that they have no planned items, with an invitation to add their first item
            var plannerArea = driver.FindElement(By.Id("plannerItems"));

            Assert.True(plannerArea.Displayed);
            Assert.Contains("You don't have anything planned. Add something above!", plannerArea.Text);

            // User enters that they have a doctor's appointment on July 2nd, 2020 at 3:00pm
            GetDescriptionInput().SendKeys("Doctor's Appointment");
            // todo -> this needs to be a date field still, but need to use custom calendar

            HelperMethods.EnterDateTimeFieldValue(GetDateInput(), "07/02/2020 3:00 PM");
            HelperMethods.EnterDateTimeFieldValue(GetEndDateInput(), "07/02/2020 3:30 PM");
            var currentCount = GetNumberOfItems();

            // User submits form and sees the item appear below
            driver.FindElement(By.Id("saveNewItemBtn")).Click();

            WaitForItemToBeAdded(currentCount);
            // the form clears
            Assert.Equal("", GetDescriptionInput().GetAttribute("value"));
            Assert.Equal("", GetDateInput().GetAttribute("value"));

            Assert.Contains("Doctor's Appointment", plannerArea.Text);
            Assert.Contains("July 2, 2020", plannerArea.Text);

            // Satisfied, user leaves the page
        }
        public void SelectPhonePreferenceAndAddToCart()
        {
            _driver.WaitForElement(_AddToCart);

            // SelectList.SelectElementbyNameValue("Storage Capacity:16GB");

            SelectElement select = new SelectElement(_Color);

            select.SelectByText("Gold");

            SelectElement storage = new SelectElement(_Storage);

            storage.SelectByValue("5");

            try
            {
                SelectElement protection = new SelectElement(_ProtectionPack);
                protection.SelectByValue("7");
            }
            catch (NoSuchElementException e)
            {
                Console.WriteLine("Protection package not visible");
            }
            _AddToCart.Click();

            _driver.WaitForElement(_NoThanksBtn);
            _NoThanksBtn.Click();
            System.Threading.Thread.Sleep(3000);
        }
        public void TutByLoginTest(string username, string password, string expectedUser)
        {
            //Open tut.by hompage
            _driver.Url = "https://tut.by";
            _driver.Manage().Window.Maximize();

            //wait for EnterButton displayed and open login popup
            _driver.WaitForElement(By.CssSelector(TutBySelectors.EnterButtonSelector));
            var enterButton = _driver.FindElement(By.CssSelector(TutBySelectors.EnterButtonSelector));

            enterButton.Click();
            Thread.Sleep(1000); //Thread.Sleep() is a waiter without a condition to wait for. Bad example of waiter.

            //provide credentials and login
            _driver.WaitForElement(By.CssSelector(TutBySelectors.UsernameInputSelector));
            var usernameInput = _driver.FindElement(By.CssSelector(TutBySelectors.UsernameInputSelector));
            var passwordInput = _driver.FindElement(By.CssSelector(TutBySelectors.PasswordInputSelector));

            _driver.TypeTextToElement(usernameInput, username);
            _driver.TypeTextToElement(passwordInput, password);
            var loginButton = _driver.FindElement(By.CssSelector(TutBySelectors.LoginButton));

            loginButton.Click();

            //validate that test user is logged in
            _driver.WaitForElement(By.CssSelector(TutBySelectors.UsernameSpanSelector));
            var usernameSpan = _driver.FindElement(By.CssSelector(TutBySelectors.UsernameSpanSelector));

            Assert.AreEqual(expectedUser, usernameSpan.Text, "User 'Selenium Test' is not logged in!");
        }
        //Update Service Listing on the Manage Listings Page
        public void UpdateServiceListings(string updateTitle)
        {
            IList <IWebElement> rows = driver.WaitForListOfElements((By.XPath("//table[@class='ui striped table']/tbody/tr")));

            for (int rnum = 1; rnum <= rows.Count; rnum++)
            {
                string titleValue = null;
                titleValue = (driver.WaitForElement(By.XPath("//table/tbody/tr[" + rnum + "]/td[3]"))).Text;
                if (titleValue == updateTitle)
                {
                    driver.WaitForElement(By.XPath("//table/tbody/tr[" + rnum + "]/td[8]/div/button[2]/i[@class='outline write icon']")).Click();
                    break;
                }
            }
        }
        internal void ValidateRecord()
        {
            //Thread.Sleep(2000);
            driver.WaitForElement((By.XPath("//a[@class='btn btn-primary']")), TimeSpan.FromSeconds(10));

            Console.WriteLine(btnCreate.Text);

            try
            {
                while (true)
                {
                    for (int i = 1; i <= 10; i++)
                    {
                        var code = driver.FindElement(By.XPath("//*[@id=\"tmsGrid\"]/div[3]/table/tbody/tr[" + i + "]/td[1]")).Text;
                        Console.WriteLine(code);

                        if ("102938" == code)
                        {
                            Console.WriteLine("Test passed");
                            return;
                        }
                    }
                    driver.FindElement(By.XPath("//*[@id=\"tmsGrid\"]/div[4]/a[3]/span")).Click();
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Test Failed");
            }
        }
Example #6
0
 public void Signout()
 {
     homeSignoutIcon.Clickme(driver);
     _logger.Info($": Successfully Clicked on Signout button");
     driver.WaitForElement(signoutButton);
     signoutButton.Clickme(driver);
 }
        private bool InputIsEmptyOrNotExampleText(IWebDriver webDriver)
        {
            IWebElement foundElement = null;

            try
            {
                foundElement = webDriver.WaitForElement(_pageElement.By, timeout: new TimeSpan(0, 0, 1));
            }
            catch (WebDriverTimeoutException)
            {
            }

            if (foundElement == null)
            {
                return(false);
            }

            string valueAttribute = foundElement.GetAttribute("value");
            string dbtAttribute   = foundElement.GetAttribute("dbt");

            if (valueAttribute == null || dbtAttribute == null)
            {
                return(false);
            }

            return(valueAttribute.Equals(String.Empty) || !valueAttribute.Equals(dbtAttribute));
        }
 /// <summary>
 /// Waits for a popup to load before proceeding with the test. Specically, it waits for an element(s) on a popup to load
 /// </summary>
 /// <param name="by">Any elements on your popup, of type By. <see cref="CBDLearnerPageBys"/></param>
 /// <param name="browser"> The IWebDriver</param>
 /// <param name="ts"> The maximum amount of time you want to wait for the window to load. i.e. TimeSpan.FromSeconds(180)</param>
 public static void WaitForPopup(IWebDriver browser, TimeSpan ts, params By[] bys)
 {
     foreach (var by in bys)
     {
         browser.WaitForElement(by, ts, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
     }
 }
 public void login()
 {
     _driver.WaitForElement(_username);
     _username.SendKeys("*****@*****.**");
     _password.SendKeys("demouser");
     _LoginBtn.Click();
 }
Example #10
0
        /// <summary>
        /// Forces the zoom level to be 100%.  This is important so that clicks and locations are reported
        /// accurately.
        /// </summary>
        /// <param name="Driver"></param>
        private void ForceIEZoomLevel(IWebDriver Driver)
        {
            var body = Driver.WaitForElement(By.TagName("html"));

            // Ctrl+0 is the IE shortcut to reset the zoom level to 100%
            body.SendKeys(Keys.Control + "0");
        }
        // [FindsBy(How = How.XPath, Using = "//div[@id='mainContent']//select")]
        // private IList<IWebElement> SelectList;

        public void SearchForProduct(string searchProduct)
        {
            _searchBox.SendKeys(searchProduct);
            _searchButton.Click();

            _driver.WaitForElement(_firstSearchResult);
            _firstSearchResult.Click();
        }
Example #12
0
        private void should_have_registration_fields(IWebDriver browser, params string[] options)
        {
            browser.WaitForElement(GetRegistrationInputSelector());

            var allTheTextFields = browser.FindElements(GetRegistrationInputSelector()).Select(e => e.GetAttribute("name")).ToArray();

            Assert.That(allTheTextFields, Is.EquivalentTo(options));
        }
Example #13
0
    // Uses JavaScript to click a checkbox - avoiding interaction errors
    public static IWebDriver ToggleCheckBox(this IWebDriver d, string xPath)
    {
        var ele = d.WaitForElement(xPath);

        try
        {
            d.ExecuteJavaScript("arguments[0].click();", ele);
        }
        catch (Exception e)
        {
            if (e.GetType() == typeof(OpenQA.Selenium.StaleElementReferenceException))
            {
                ele = d.WaitForElement(xPath);
                d.ExecuteJavaScript("arguments[0].click();", ele);
            }
        }
        return(d);
    }
Example #14
0
        public override void SpecifyForBrowser(IWebDriver browser)
        {
            var server = beforeAll(() => new StaticServer()
            {
                { "jquery.js", JQuerySource.GetJQuerySource() }
            }.Start());

            beforeAll(() => server.Add("delay.html",
                                       JQueryUtil.HtmlLoadingJQuery(server.UrlFor("jquery.js"), "<div> Hello, world. </div>")));

            describe("WaitForElement", delegate
            {
                arrange(() => browser.Navigate().GoToUrl(server.UrlFor("delay.html")));

                it("can find an element on the page", delegate
                {
                    expect(() => browser.WaitForElement(BySizzle.CssSelector("div:contains('Hello, world')")) != null);
                });

                it("reports a useful error if the element is not eventually found", delegate
                {
                    var expectedMessage = Assert.Throws <NoSuchElementException>(delegate
                    {
                        browser.FindElement(By.CssSelector("div div li ul ol lol.so img.nothappening"));
                    }).Message;

                    var actualException = Assert.Throws <NoSuchElementException>(delegate
                    {
                        browser.WaitForElement(By.CssSelector("div div li ul ol lol.so img.nothappening"));
                    });

                    expect(() => actualException.Message.Contains(expectedMessage));
                });

                it("will wait for elements", delegate
                {
                    (browser as IJavaScriptExecutor).ExecuteScript(@"
setTimeout(function() { $('body').append('<div>Better late than never.</div>'); }, 2000);
");

                    expect(() => browser.WaitForElement(BySizzle.CssSelector("div:contains('Better late than never.')")) != null);
                });
            });
        }
        public override void SpecifyForBrowser(IWebDriver browser)
        {
            var server = beforeAll(() => new StaticServer()
                {
                    {"jquery.js", JQuerySource.GetJQuerySource()}
                }.Start());

            beforeAll(() => server.Add("delay.html",
                JQueryUtil.HtmlLoadingJQuery(server.UrlFor("jquery.js"), "<div> Hello, world. </div>")));

            describe("WaitForElement", delegate
            {
                arrange(() => browser.Navigate().GoToUrl(server.UrlFor("delay.html")));

                it("can find an element on the page", delegate
                {
                    expect(() => browser.WaitForElement(BySizzle.CssSelector("div:contains('Hello, world')")) != null);
                });

                it("reports a useful error if the element is not eventually found", delegate
                {
                    var expectedMessage = Assert.Throws<NoSuchElementException>(delegate
                    {
                        browser.FindElement(By.CssSelector("div div li ul ol lol.so img.nothappening"));
                    }).Message;

                    var actualException = Assert.Throws<NoSuchElementException>(delegate
                    {
                        browser.WaitForElement(By.CssSelector("div div li ul ol lol.so img.nothappening"));
                    });

                    expect(() => actualException.Message.Contains(expectedMessage));
                });

                it("will wait for elements", delegate
                {
                    (browser as IJavaScriptExecutor).ExecuteScript(@"
            setTimeout(function() { $('body').append('<div>Better late than never.</div>'); }, 2000);
            ");

                    expect(() => browser.WaitForElement(BySizzle.CssSelector("div:contains('Better late than never.')")) != null);
                });
            });
        }
Example #16
0
        /// <summary>
        /// Returns true if the text is found under the first column of the table
        /// </summary>
        /// <param name="tableBodyElem">The table element</param>
        /// <param name="tableElemBodyBy">The tbody element within the table as it exists in it's By type</param>
        /// <param name="expectedText">The text you expect to be under the first column of your table</param>
        /// <param name="tagNameThatTextExistsWithin">Inspect your table's cell to determine what type of element the text exists within. Then send the tag name to this parameter</param>
        /// <param name="FirstBtn">Enter "null" if your table does NOT contain Previous and Next button. If it does contain these buttons, then pass the First button element first, and then the Next button element. For example, pass "Bys.CBDLearnerPage.TableFirstBtn"</param>
        /// <param name="NextBtn">Enter "null" if your table does NOT contain Previous and Next button. If it does contain these buttons, then pass the First button element first, and then the Next button element. For example, pass "Bys.CBDLearnerPage.TableFirstBtn"</param>
        /// <returns></returns>
        public static bool Grid_ContainsRecord(IWebDriver browser, IWebElement tableElem, By tableElemBodyBy, string expectedText, string tagNameThatTextExistsWithin, By FirstBtn = null, By NextBtn = null)
        {
            browser.WaitForElement(tableElemBodyBy, TimeSpan.FromSeconds(180), ElementCriteria.HasText, ElementCriteria.IsEnabled, ElementCriteria.IsEnabled);

            // If the table does not contain first, next, previous and last buttons. Or if the table does contains them,
            // but there are not enough records to have multiple pages, then we only need to check one page of results
            if (FirstBtn == null || !browser.Exists(NextBtn, ElementCriteria.IsVisible))
            {
                if (Grid_CellTextFound(tableElem, tagNameThatTextExistsWithin, expectedText))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            // If the table has First, Previous, Next and Last buttons. And if those buttons are visible and enabled (The class attribute would equal "first cdisabled" if
            // it was disabled), then click the First button to go to the first listing of records
            if (browser.Exists(FirstBtn, ElementCriteria.IsVisible, ElementCriteria.AttributeValue("class", "first")))
            {
                browser.FindElement(FirstBtn).Click();
                Thread.Sleep(2000);      // TODO: Implement logic for dynamic wait instead of sleep
                                         // Check to see if the cell is found on the first page of results
                if (Grid_CellTextFound(tableElem, tagNameThatTextExistsWithin, expectedText))
                {
                    return(true);
                }
            }

            if (Grid_CellTextFound(tableElem, tagNameThatTextExistsWithin, expectedText))
            {
                return(true);
            }

            // If code reaches here, the cell text was not found yet, and so we should click the next button if there is one and
            // try to find the cell text on the next page, and continue until there are no pages left
            if (browser.Exists(NextBtn, ElementCriteria.IsVisible))
            {
                while (browser.Exists(NextBtn, ElementCriteria.AttributeValue("class", "next"))) // While the next button is not disabled
                {
                    browser.FindElement(NextBtn).Click();                                        // Click the next button
                    Thread.Sleep(2000);                                                          // TODO: Implement logic for dynamic wait instead of sleep

                    if (Grid_CellTextFound(tableElem, tagNameThatTextExistsWithin, expectedText))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        private const int DEFAULT_WAIT_TIME = 15; // Seconds
        public static void LoginToTestAccount(this IWebDriver driver)
        {
            driver.Navigate().GoToUrl(@$ "{TestConfig.BASEURL}/authentication/signin");
            driver.WaitForElement(By.Id("loginForm"), 90);
            var loginForm = driver.FindElement(By.Id("loginForm"));
            var inputs    = loginForm.FindElements(By.TagName("INPUT"));

            inputs[0].SendKeys(TestConfig.EMAIL);
            inputs[1].SendKeys(TestConfig.PASSWORD);
            loginForm.FindElement(By.CssSelector("button[type='submit']")).Click();
        }
Example #18
0
 public static void WaitForGivenElementToBeVisible(this IWebDriver driver, IHtmlControl element, int timeout = 45)
 {
     try
     {
         driver.WaitForElement(element, el => el.Visible, timeout);
     }
     catch (WebDriverTimeoutException)
     {
         string msg = "Waiting for element to be visible failed.";
         throw new WebDriverTimeoutException(msg);
     }
 }
Example #19
0
 public static bool TryWaitForGivenElementToBeNotVisible(this IWebDriver driver, IHtmlControl element, int timeout = 45)
 {
     try
     {
         driver.WaitForElement(element, el => !element.Element.Displayed, timeout, false);
         return(true);
     }
     catch (WebDriverTimeoutException)
     {
         return(false);
     }
 }
Example #20
0
 public static void WaitForGivenElementToBeNotVisible(this IWebDriver driver, IHtmlControl element, int timeout = 45)
 {
     try
     {
         driver.WaitForElement(element, el => !element.Element.Displayed, timeout, false);
     }
     catch (WebDriverTimeoutException)
     {
         string msg = "Waiting for element to be not visible failed.";
         throw new WebDriverTimeoutException(msg);
     }
 }
 /// <summary>
 /// This method identifies if the success message is returned
 /// </summary>
 /// <param name="driver"></param>
 /// <returns>true or false</returns>
 public static bool IsSuccessMessageReturned(this IWebDriver driver)
 {
     try
     {
         var element = driver.WaitForElement(By.CssSelector("div.ant-message-success"));
         return(true);
     }
     catch (WebDriverTimeoutException)
     {
         return(false);
     }
 }
 public void SearchAHotel()
 {
     _driver.WaitForElement(_searchHotelOrCityTxtBox);
     _searchbox.Click();
     _searchHotelOrCityTxtBox.SendKeys("Hotel-97583");
     _driver.WaitForElement(_hotelInNewYork);
     _hotelInNewYork.Click();
     _checkin.SendKeys("18/07/2019");
     _checkout.SendKeys("19/07/2019");
     _searchBtn.Click();
 }
Example #23
0
        public void ThenTheArticleShouldBeDeleted()
        {
            var deleteConfirm = Driver.WaitForElement(By.XPath("(//span[contains(.,'Removed article')])[2]"));

            if (!string.IsNullOrEmpty(deleteConfirm.Text))
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail();
            }
        }
        //check AllCategory is active as well as the totals are changing
        private string GetAllCategoryTotals()
        {
            var    AllCat = Driver.WaitForElement(By.XPath("//a[@class='active item']"));
            string total  = null;

            Driver.wait(10);
            if (AllCat.Displayed && AllCat.Enabled)
            {
                var span = AllCat.FindElement(By.XPath(".//span"));
                total = span.Text;
            }
            return(total);
        }
Example #25
0
 public void ClickEditTemplate()
 {
     foreach (var temp in Template)
     {
         string findtemplate = CreateArticle.GetRowByKey("valid").GetValue("templateName");
         string T            = temp.Text;
         if (T == findtemplate)
         {
             IWebElement EditBtn = Driver.WaitForElement(By.XPath("//td[contains(text(),'" + T + "')]//parent::tr//descendant::td//div//i[@aria-label='icon: edit']"));
             EditBtn.Click();
         }
     }
 }
 /// <summary>
 /// Wait for element to be clickable
 /// </summary>
 /// <param name="driver"></param>
 /// <param name="by"></param>
 /// <param name="timeOutInSeconds"></param>
 /// <returns></returns>
 public static IWebElement WaitForClickable(this IWebDriver driver, By by, int timeOutInSeconds = 10)
 {
     try
     {
         var element = driver.WaitForElement(by);
         var wait    = new WebDriverWait(driver, TimeSpan.FromSeconds(timeOutInSeconds));
         wait.Until(d => element.Enabled);
         return(element);
     }
     catch (WebDriverTimeoutException)
     {
         throw new WebDriverTimeoutException($"Wait for element {by} to be clickable failed ");
     }
 }
        /// <summary>
        /// Uploads a file by directly sending the file path to the JQuery File Upload browse button. To
        /// determine if you application is compatible (it uses the JQuery file upload system), there
        /// should be an input tag in your HTML representing the browse/fileupload/etc button (Note
        /// that this button may be hidden under a browse button that doesnt meet these requirements)
        /// This Input element should have an attribute titled "type", and it's attribute value should be
        /// "file". If you find it still doesnt work, then tell your developer to change this element from multiple
        /// to single. Further reading: https://stackoverflow.com/questions/27331884/selenium-chromedriver-sendkeys-breaks-jquery-file-upload-plugin</param>
        /// </summary>
        /// <param name="browser">The driver instance</param>
        /// <param name="browseBtnElem">The browse button of IWebElement type, which should be the Input tag with an attribute of "file". See summary above for further explanation </param>
        /// <param name="browseBtnBy">The browse button of By type, which should be the Input tag with an attribute of "file". See summary above for further explanation </param>
        /// <param name="filePath">The full path, including the filename</param>
        public static void UploadFileUsingSendKeys(IWebDriver browser, IWebElement browseBtnElem, By browseBtnBy, string filePath)
        {
            // If this button is not visible, then we need to remove the style attribute, as the style attribute most likely has a value
            // of "display:none", which controls whether it is displayed or not
            browser.ExecuteScript("arguments[0].removeAttribute(\"style\");", browseBtnElem);
            // We also have to remove the multiple attribute, if it has one
            browser.ExecuteScript("arguments[0].removeAttribute(\"multiple\");", browseBtnElem);


            // Once the button is displayed, then send keys
            browser.WaitForElement(browseBtnBy, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible);
            browseBtnElem.SendKeys(filePath);
            Thread.Sleep(0300);
        }
Example #28
0
        public override Result Run2(IWebDriver browser, Stopwatch sw, string URL)
        {
            sw.Restart();

            browser.Navigate().GoToUrl(URL + "Authentication/Account/LogOn");
            browser.WaitForPageLoad();

            sw.Stop();

            // Enter login and password
            TextBox txtUsername = (TextBox)_userControl.Controls.Find("txtLogin", true).FirstOrDefault();
            TextBox txtPassword = (TextBox)_userControl.Controls.Find("txtPassword", true).FirstOrDefault();

            var username = txtUsername.Text;
            var password = txtPassword.Text;

            browser.FindElement(By.Id("UserName")).SendKeys(username);
            browser.FindElement(By.Id("Password")).SendKeys(password);

            sw.Restart();

            browser.FindElement(By.ClassName("button24_left")).Click();

            browser.WaitForElement(By.Id("navigationItemsContainer"), 60);

            sw.Stop();

            var url = browser.Url;

            if (url.Contains("Authentication/Account/LogOn"))
            {
                //Login failed
                throw new TestErrorException("Login failed.", Result.StopAndCloseBrowser);
            }
            else if (browser.IsTextPresent("Server Error"))
            {
                //Login failed
                throw new TestErrorException("Login failed. Server error.", Result.StopAndCloseBrowser);
            }

            return(Result.Continue);
        }
		private bool InputIsEmptyOrNotExampleText(IWebDriver webDriver)
		{
			IWebElement foundElement = null;
			try
			{
				foundElement = webDriver.WaitForElement(_pageElement.By, timeout: new TimeSpan(0, 0, 1));
			}
			catch (WebDriverTimeoutException)
			{
			}

			if (foundElement == null)
				return false;

			string valueAttribute = foundElement.GetAttribute("value");
			string dbtAttribute = foundElement.GetAttribute("dbt");
			if (valueAttribute == null || dbtAttribute == null)
				return false;

			return valueAttribute.Equals(String.Empty) || !valueAttribute.Equals(dbtAttribute);
		}
        //This method returns the total jobs and actual jobs based on the info from UI.
        public (int, int) ValidateTotalJobs()
        {
            if (Jobs.Displayed && Jobs.Enabled)
            {
                var text      = Driver.WaitForElement(By.CssSelector("main .ant-row > p")).Text;
                var totalJobs = Int16.Parse(text.Split(" ")[3]);
                Console.WriteLine("Jobs at my account: " + totalJobs);
                if (Pagination.Count > 3)
                {
                    Pagination[Pagination.Count - 2].Click();
                    var len    = Driver.WaitForElements(By.CssSelector(".ant-spin-container .ant-row > .ant-col")).Count;
                    var actual = 6 * (Pagination.Count - 3) + len;
                    Console.WriteLine("Total length: " + actual);

                    return(totalJobs, actual);
                }
                else
                {
                    throw new Exception("No jobs are posted by you at this stage!!!");
                }
            }
            return(0, -1);
        }
Example #31
0
        /// <summary>
        /// Navigates to a given page through a single or multi-layered menu system
        /// </summary>
        /// <param name="browser">The driver instance</param>
        /// <param name="menuItems">If it is a single-layered menu, then only 1 By type will be needed. If it is multi-layered, the tester should
        /// pass the By types in the order they would click the menu items manually</param>
        /// <returns>The page object, which contains all elements of the page and any page related methods</returns>
        public dynamic NavigateThroughMenuItems(IWebDriver browser, params By[] menuItems) //By menu1, By menu2 = null, By menu3 = null,
        {
            if (menuItems.Length == 1)
            {
                IWebElement elemToClick = browser.FindElement(menuItems[0]);
                elemToClick.Click();
            }

            else
            {
                for (int i = 0; i < menuItems.Length - 1; i++)
                {
                    IWebElement elemToClick = browser.WaitForElement(menuItems[0], ElementCriteria.IsVisible);
                    elemToClick.Click();
                }
            }

            IWebElement elemtToClick = browser.FindElement(menuItems[menuItems.Length - 1]);

            elemtToClick.Click();


            return(null);
        }
Example #32
0
 public void ClickDashBoardTab()
 {
     driver.WaitForElement(DashBoardTab);
     DashBoardTab.Clickme(driver);
 }
Example #33
0
        private void should_have_registration_fields(IWebDriver browser, params string[] options)
        {
            browser.WaitForElement(GetRegistrationInputSelector());

            var allTheTextFields = browser.FindElements(GetRegistrationInputSelector()).Select(e => e.GetAttribute("name")).ToArray();

            Assert.That(allTheTextFields, Is.EquivalentTo(options));
        }