CssSelector() public static méthode

Gets a mechanism to find elements by their cascading stylesheet (CSS) selector.
public static CssSelector ( string cssSelectorToFind ) : By
cssSelectorToFind string The CSS selector to find.
Résultat By
        /// <summary>
        /// Click the 'Edit' button for a position category
        /// </summary>
        /// <param name="categoryName">The name of the category to edit</param>
        public void EditPositionCategory(string categoryName = null)
        {
            // if the category isnt specified, find the first category in the list
            if (String.IsNullOrWhiteSpace(categoryName))
            {
                categoryName = _driver.FindElement(By.CssSelector("#maintbl > tbody > #rowNbr0 > td > b")).Text;
            }

            ((IJavaScriptExecutor)_driver).ExecuteScript("EditPositionCategory('" + categoryName + "')");
        }
Exemple #2
0
        /// <summary>
        /// Open the page for a search result using linktext
        /// </summary>
        /// <param name="result">The text of the record to be opened</param>
        public override void SelectSearchResult(string result)
        {
            var name = _driver.FindElement(By.LinkText(result));

            name.WaitAndClick(_driver);

            var openApplicationLink = _driver.FindElement(By.CssSelector(".popover-content a"));
            var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(30));

            wait.Until(ExpectedConditions.ElementToBeClickable(openApplicationLink));
            openApplicationLink.WaitAndClick(_driver);
        }
Exemple #3
0
        ///
        //Methods
        //
        public void SetupGatedAccess()
        {
            driver.FindElement(_featuresLeftPanelIcon).Click();
            driver.FindElement(_hardwareACT365FeatureCheckbox).Click();
            driver.FindElement(_hardwareLightingFeatureCheckbox).Click();
            driver.FindElement(_featureSaveButton).Click();
            driver.FindElement(_bookingLeftPanelIcon).Click();
            driver.FindElement(_bookingSettingsHyperLink).Click();
            driver.FindElement(_manageBasicSettingsOnBookingPageButton).Click();

            IReadOnlyCollection <IWebElement> elements = driver.FindElements(By.CssSelector(".panel:nth-child(2) h2"));

            Console.WriteLine(elements);
            Assert.IsTrue(elements.Count > 0);
            Assert.IsTrue(driver.FindElement(By.CssSelector(".radio-inline .checked")).Enabled);
            var value = driver.FindElement(By.Id("select2-Hardware_Act365_SiteID-container")).Text;

            Assert.AreEqual("SportLabs", value);

            driver.FindElement(_saveBasicSettings).Click();
            driver.FindElement(_bookingSettingsHyperLink).Click();
            driver.FindElement(_bookingManageCourtsLink).Click();
            driver.FindElement(By.CssSelector(".select2-container--focus .select2-selection__rendered")).Click();
            var gateValueText = driver.FindElement(By.CssSelector(".select2-container--focus .select2-selection__choice")).Text;

            Assert.AreSame("Door Controller-3(Circuit-1)", gateValueText);
            driver.FindElement(By.CssSelector(".form-actions > .btn")).Click();
            IReadOnlyCollection <IWebElement> elements1 = driver.FindElements(By.CssSelector(".modal-title:nth-child(2)"));

            Console.WriteLine(elements1);

            Assert.IsTrue(elements1.Count > 0);

            driver.FindElement(_featuresLeftPanelIcon).Click();
            driver.FindElement(_hardwareACT365FeatureCheckbox).Click();
            driver.FindElement(_hardwareLightingFeatureCheckbox).Click();
            driver.FindElement(_featureSaveButton).Click();
        }
 public AssertionResultPage InputFixtureA()
 {
     Input().Model(Form1Fixtures.A);
     return(Navigate().To <AssertionResultPage>(By.CssSelector("input[type=submit]")));
 }
 /// <summary>
 /// Gets a mechanism to find elements by their cascading style sheet (CSS) selector.
 /// </summary>
 /// <param name="cssSelectorToFind">The CSS selector to find.</param>
 /// <returns>A <see cref="OpenQA.Selenium.By"/> object the driver can use to find the elements.</returns>
 public static new SeleniumBy CssSelector(string cssSelectorToFind) =>
 SeleniumBy.CssSelector(cssSelectorToFind);
Exemple #6
0
 public void FindingMultipleElementsByInvalidCssSelectorShouldThrow()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws(Is.InstanceOf <NoSuchElementException>(), () => { driver.FindElements(By.CssSelector("//a/b/c[@id='1']")); });
 }
Exemple #7
0
 public void FindingASingleElementByEmptyCssSelectorShouldThrow()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws(Is.InstanceOf <NoSuchElementException>(), () => { driver.FindElement(By.CssSelector("")); });
 }
Exemple #8
0
 public void ShouldNotFindElementByCssSelectorWhenThereIsNoSuchElement()
 {
     driver.Url = xhtmlTestPage;
     Assert.Throws <NoSuchElementException>(() => driver.FindElement(By.CssSelector(".there-is-no-such-class")));
 }