当前位置: 首页>>代码示例>>C#>>正文


C# RemoteWebDriver.FindElementByCssSelector方法代码示例

本文整理汇总了C#中OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByCssSelector方法的典型用法代码示例。如果您正苦于以下问题:C# RemoteWebDriver.FindElementByCssSelector方法的具体用法?C# RemoteWebDriver.FindElementByCssSelector怎么用?C# RemoteWebDriver.FindElementByCssSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenQA.Selenium.Remote.RemoteWebDriver的用法示例。


在下文中一共展示了RemoteWebDriver.FindElementByCssSelector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SubmitLoginForm

 public static void SubmitLoginForm(RemoteWebDriver browser, string email, string password)
 {
     var formSelector = "form[action^='/Account/Login'] ";
     browser.FindElementByCssSelector(formSelector + "input#Email").SendKeys(email);
     browser.FindElementByCssSelector(formSelector + "input#Password").SendKeys(password);
     browser.FindElementByCssSelector(formSelector + "input[value='Log in']").Click();
     WaitUntilUserIsLoggedIn(browser);
 }
开发者ID:Natsui31,项目名称:keyhub,代码行数:8,代码来源:SiteUtil.cs

示例2: SetValueForChosenJQueryControl

        public static void SetValueForChosenJQueryControl(RemoteWebDriver browser, string cssSelector, string value)
        {
            browser.FindElementByCssSelector(cssSelector);  // ensure the form field is present

            //  Click a contained ".chzn-single" element, if available
            var clickTarget = browser.FindElementByCssSelector(cssSelector + " .chzn-single");
            clickTarget.Click();

            browser.FindElementByCssSelector(cssSelector + " input[type=text]").SendKeys(value + Keys.Tab);
        }
开发者ID:Natsui31,项目名称:keyhub,代码行数:10,代码来源:SiteUtil.cs

示例3: ShouldContainCustomerUsername

		public static void ShouldContainCustomerUsername( RemoteWebDriver driver, AuthenticatingNavigator navigator )
		{
			using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
			{
				navigator.NavigateWithAuthenticate( driver, "" );
                WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
                var userSettingsMenu = wait.Until( d => driver.FindElementByCssSelector( "button[name='settings']" ) );
                userSettingsMenu.Click();
                var usernameElement = wait.Until( d => driver.FindElementByCssSelector( "li[id='username']" ) );

				Assert.Contains( ConfigurationManager.AppSettings[ "PortalUsername" ], usernameElement.Text );
			}
		}
开发者ID:InishTech,项目名称:Sp.Api,代码行数:13,代码来源:LandingPage.cs

示例4: CreateAccountRightsFor

        public static void CreateAccountRightsFor(RemoteWebDriver browser, string userEmail, ObjectTypes objectType, string objectName)
        {
            browser.FindElementByCssSelector("a[href='/Account']").Click();
            var vendorUserRow =
                browser.FindElementByLinkText(userEmail).FindElement(By.XPath("./ancestor::tr"));

            vendorUserRow.FindElement(By.CssSelector("a[href^='/Account/Edit']")).Click();

            browser.FindElementByCssSelector("a[href^='/AccountRights/Create'][href$='" + Enum.GetName(typeof(ObjectTypes), objectType) + "']").Click();

            SiteUtil.SetValueForChosenJQueryControl(browser, "#ObjectId_chzn", objectName);
            browser.FindElementByCssSelector("form[action^='/AccountRights/Create'] input[type='submit']").Click();
            browser.FindElementByCssSelector(".success");
        }
开发者ID:Natsui31,项目名称:keyhub,代码行数:14,代码来源:AdminUtil.cs

示例5: SignoffShouldRedirectToHostRoot

		public static void SignoffShouldRedirectToHostRoot( RemoteWebDriver driver, AuthenticatingNavigator navigator )
		{
			using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
			{
				navigator.NavigateWithAuthenticate( driver, "" );
				WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
                var userSettingsMenu = wait.Until( d => driver.FindElementByCssSelector( "button[name='settings']" ) );
                userSettingsMenu.Click();
                var logoffButton = wait.Until( d => driver.FindElementByCssSelector( "a[name='logoff']" ) );

				var portalUrl = new Uri( driver.Url );
				logoffButton.Click();

				var signoffLandingUrl = new Uri( driver.Url );
				Assert.Equal( portalUrl.Authority, signoffLandingUrl.Authority );
			}
		}
开发者ID:InishTech,项目名称:Sp.Api,代码行数:17,代码来源:LandingPage.cs

示例6: CreateVendor

        public static string CreateVendor(RemoteWebDriver browser)
        {
            string vendorName = "vendor name";

            browser.FindElementByCssSelector("a[href='/Vendor']").Click();
            browser.FindElementByCssSelector("a[href='/Vendor/Create']").Click();

            browser.FindElementByCssSelector("input#Vendor_Name").SendKeys(vendorName);
            browser.FindElementByCssSelector("input#Vendor_Street").SendKeys("vendor street");
            browser.FindElementByCssSelector("input#Vendor_PostalCode").SendKeys("vendor street");
            browser.FindElementByCssSelector("input#Vendor_City").SendKeys("vendor city");
            browser.FindElementByCssSelector("input#Vendor_Region").SendKeys("vendor region");

            browser.FindElementByCssSelector("form[action='/Vendor/Create'] input[type=submit]").Click();
            browser.FindElementByCssSelector(".success");

            return vendorName;
        }
开发者ID:Natsui31,项目名称:keyhub,代码行数:18,代码来源:AdminUtil.cs

示例7: SetValueForChosenJQueryControlMulti

        public static void SetValueForChosenJQueryControlMulti(
            RemoteWebDriver browser,
            string cssSelector, string value,
            bool clearExisting = false)
        {
            var clickTarget = browser.FindElementByCssSelector(cssSelector);

            clickTarget.Click();

            if (clearExisting)
            {
                foreach (var removeButton in browser.FindElementsByCssSelector(cssSelector + " li .search-choice-close"))
                {
                    removeButton.Click();
                }
            }

            var selection =
                browser.FindElementsByCssSelector(cssSelector + " li").FirstOrDefault(e => e.Text.Contains(value));

            Assert.NotNull(selection);

            selection.Click();
        }
开发者ID:Natsui31,项目名称:keyhub,代码行数:24,代码来源:SiteUtil.cs

示例8: FillVendorCredentialForm

 private static void FillVendorCredentialForm(RemoteWebDriver browser, string name, string value)
 {
     browser.FindElementByCssSelector("input#CredentialName").Clear();
     browser.FindElementByCssSelector("input#CredentialName").SendKeys(name);
     browser.FindElementByCssSelector("input#CredentialValue").Clear();
     browser.FindElementByCssSelector("input#CredentialValue").SendKeys(value);
 }
开发者ID:Natsui31,项目名称:keyhub,代码行数:7,代码来源:AdminTests.cs

示例9: SubmitTransactionCheckoutFormWithNewCustomer

 private static void SubmitTransactionCheckoutFormWithNewCustomer(RemoteWebDriver browser)
 {
     var formSelector = "form[action^='/Transaction/Checkout'] ";
     browser.FindElementByCssSelector(formSelector + "input#NewPurchasingCustomer_Customer_Name")
         .SendKeys("customerName");
     browser.FindElementByCssSelector(formSelector + "input#NewPurchasingCustomer_Customer_Street")
         .SendKeys("123 Fake St.");
     browser.FindElementByCssSelector(formSelector + "input#NewPurchasingCustomer_Customer_PostalCode").SendKeys("98105");
     browser.FindElementByCssSelector(formSelector + "input#NewPurchasingCustomer_Customer_City").SendKeys("Seattle");
     browser.FindElementByCssSelector(formSelector + "input#NewPurchasingCustomer_Customer_Region").SendKeys("WA");
     browser.FindElementByCssSelector(formSelector + "input[type=submit]").Click();
 }
开发者ID:Natsui31,项目名称:keyhub,代码行数:12,代码来源:TransactionTests.cs

示例10: AssertVendorCredentialFormValues

 private static void AssertVendorCredentialFormValues(RemoteWebDriver browser, string name, string value)
 {
     Assert.Equal(name, browser.FindElementByCssSelector("input#CredentialName").GetAttribute("value"));
     Assert.Equal(value, browser.FindElementByCssSelector("input#CredentialValue").GetAttribute("value"));
 }
开发者ID:Natsui31,项目名称:keyhub,代码行数:5,代码来源:AdminTests.cs

示例11: FindElement

        protected IWebElement FindElement(RemoteWebDriver webDriver, Selector element)
        {
            switch (element.Type)
            {

                case ExtractType.XPath:
                    {
                        return webDriver.FindElementByXPath(element.Expression);
                    }
                case ExtractType.Css:
                    {
                        return webDriver.FindElementByCssSelector(element.Expression);
                    }
            }
            throw new SpiderExceptoin("Unsport findy: " + element.Type);
        }
开发者ID:yalunwang,项目名称:DotnetSpider,代码行数:16,代码来源:CookieThief.cs

示例12: GetAppKeyFromTransactionCompletePage

 private static Guid GetAppKeyFromTransactionCompletePage(RemoteWebDriver browser)
 {
     var appKeyValue = Guid.Parse(browser.FindElementByCssSelector("#customerAppKeyValue").Text.Trim());
     return appKeyValue;
 }
开发者ID:Natsui31,项目名称:keyhub,代码行数:5,代码来源:TransactionTests.cs

示例13: SubmitRegistrationForm

 public static void SubmitRegistrationForm(RemoteWebDriver browser, string email, string password)
 {
     browser.FindElementByCssSelector("input[name=Email]").SendKeys(email);
     browser.FindElementByCssSelector("input[name=Password]").SendKeys(password);
     browser.FindElementByCssSelector("input[name=ConfirmPassword]").SendKeys(password);
     browser.FindElementByCssSelector("input[value=Register]").Click();
 }
开发者ID:Natsui31,项目名称:keyhub,代码行数:7,代码来源:SiteUtil.cs

示例14: AssertApplicationNameIs

 private void AssertApplicationNameIs(RemoteWebDriver browser, string expectedName)
 {
     var applicationLink = browser.FindElementByCssSelector("a[href^='/CustomerApp/Details']");
     Assert.Equal(expectedName, applicationLink.Text.Trim());
 }
开发者ID:Natsui31,项目名称:keyhub,代码行数:5,代码来源:VendorRequirements.cs

示例15: GetCurrentUserId

 int GetCurrentUserId(RemoteWebDriver browser)
 {
     browser.FindElementByCssSelector("a[href='/Account']").Click();
     var editLink = browser.FindElementByCssSelector("a[href^='/Account/Edit']").GetAttribute("href");
     return int.Parse(Regex.Match(editLink, @"(\d+)$").Groups[1].Value);
 }
开发者ID:Natsui31,项目名称:keyhub,代码行数:6,代码来源:AccountTests.cs


注:本文中的OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByCssSelector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。