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


C# IWebElement.GetAttribute方法代码示例

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


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

示例1: GetButtonText

 public static string GetButtonText(By locator)
 {
     element = GenericHelper.GetElement(locator);
     if (element.GetAttribute("value") == null)
         return String.Empty;
     return element.GetAttribute("value");
 }
开发者ID:Saltorel,项目名称:BDD-CSharp,代码行数:7,代码来源:ButtonHelper.cs

示例2: BadConnectionStringNotification

 internal BadConnectionStringNotification(IWebElement notification)
     : base(notification)
 {
     if (!notification.GetAttribute("class").Contains("alert") ||
         !notification.GetAttribute("class").Contains("alert-danger"))
     {
         throw new ArgumentException("The element must be a danger alert");
     }
 }
开发者ID:farukc,项目名称:azure-webjobs-sdk-dashboard-tests,代码行数:9,代码来源:BadConnectionStringNotification.cs

示例3: InvocationStatusNotification

 internal InvocationStatusNotification(IWebElement notification)
     : base(notification)
 {
     if (!notification.GetAttribute("class").Contains("alert") ||
         !notification.GetAttribute("ng-class").Contains("model.invocation.getAlertClass()"))
     {
         throw new ArgumentException("The element is not an invocation status notification");
     }
 }
开发者ID:farukc,项目名称:azure-webjobs-sdk-dashboard-tests,代码行数:9,代码来源:InvocationStatusNotification.cs

示例4: OldHostNotification

 internal OldHostNotification(IWebElement notification)
     : base(notification)
 {
     if (!notification.GetAttribute("class").Contains("alert") ||
         !notification.GetAttribute("class").Contains("alert-warning") ||
         !notification.GetAttribute("ng-if").Equals("isOldHost"))
     {
         throw new ArgumentException("The element is not an old host notification");
     }
 }
开发者ID:farukc,项目名称:azure-webjobs-sdk-dashboard-tests,代码行数:10,代码来源:OldHostNotification.cs

示例5: KendoTreeView

 /// <summary>
 /// Initializes a new instance of the <see cref="KendoTreeView"/> class.
 /// </summary>
 /// <param name="webElement">The webElement</param>
 public KendoTreeView(IWebElement webElement)
     : base(webElement.ToDriver() as RemoteWebDriver, null)
 {
     this.webElement = webElement;
     var id = webElement.GetAttribute("id");
     this.kendoTreeView = string.Format(CultureInfo.InvariantCulture, "$('#{0}').data('kendoTreeView')", id);
 }
开发者ID:raczeja,项目名称:Test.Automation,代码行数:11,代码来源:KendoTreeView.cs

示例6: FindTextbox

        public static IWebElement FindTextbox(ISearchContext context, IWebElement element)
        {
            var id = element.GetAttribute("id");
            var labelId = id + "Value";

            return context.FindElement(By.Id(labelId));
        }
开发者ID:DarthFubuMVC,项目名称:FubuMVC.AutoComplete,代码行数:7,代码来源:AutoCompleteHandler.cs

示例7: ParseSpecClasses

 static IEnumerable<string> ParseSpecClasses(IWebElement resultMessage)
 {
     return resultMessage
         .GetAttribute("class")
         .Split(' ')
         .Where(c => c != "resultMessage" && c != "specDetail" && c != "specSummary");
 }
开发者ID:Sqdw,项目名称:SQUnit,代码行数:7,代码来源:JasmineTestSuite.cs

示例8: FillElement

        protected void FillElement(IWebElement element, object value)
        {
            if (value == null)
            {
                return;
            }

            if (IsInput(element))
            {
                String inputType = element.GetAttribute("type");
                if (inputType == null || inputType == TextInputType || inputType == PasswordInputType)
                {
                    element.SendKeys(value.ToString());
                }
                else if (inputType == CheckboxType)
                {
                    CheckBox checkBox = new CheckBox(element);
                    checkBox.Set(bool.Parse(value.ToString()));
                }
                else if (inputType == RadioType)
                {
                    Radio radio = new Radio(element);
                    radio.SelectByValue(value.ToString());
                }
            }
            else if (IsSelect(element))
            {
                Select select = new Select(element);
                select.SelectByValue(value.ToString());
            }
            else if (IsTextArea(element))
            {
                element.SendKeys(value.ToString());
            }
        }
开发者ID:VNikita,项目名称:Test_auto,代码行数:35,代码来源:Form.cs

示例9: IsLabelElementFor

        private bool IsLabelElementFor(IWebElement labelElement)
        {
            var forValue = labelElement.GetAttribute("for");
            var idValue = NativeElement.GetAttribute("id");
            var nameValue = NativeElement.GetAttribute("name");

            return forValue.Equals(idValue, StringComparison.InvariantCultureIgnoreCase) || forValue.Equals(nameValue, StringComparison.InvariantCultureIgnoreCase);
        }
开发者ID:sunstream,项目名称:Framework_v2_0_ProofOfConcept,代码行数:8,代码来源:SeleniumCheckBoxBehavior.cs

示例10: BrokenImages

 //Broken Images
 public void BrokenImages(IWebElement ele)
 {
     string str = ele.GetAttribute("src");
     if (str.EndsWith(".jpg"))
         Console.WriteLine("Pass");
     else
         Assert.Fail();
 }
开发者ID:venkatakumar9,项目名称:AKEcommerceAutomationTesting,代码行数:9,代码来源:BasePage.cs

示例11: EraseData

 public virtual void EraseData(ISearchContext context, IWebElement element)
 {
     if (element.GetAttribute("value").IsNotEmpty())
     {
         element.Click();
         element.SendKeys(Keys.Home + Keys.Shift + Keys.End + Keys.Backspace);
     }
 }
开发者ID:DarthFubuMVC,项目名称:Serenity,代码行数:8,代码来源:TextboxElementHandler.cs

示例12: TestDidPass

		public bool TestDidPass(IWebElement testElement) {
			try { 
				return testElement.GetAttribute("class") == "pass";
			}
			catch(NoSuchElementException) {
				return false;
			}
		}
开发者ID:amg-argh,项目名称:Amg.UnitTests.JsRunner,代码行数:8,代码来源:QUnitElementLocator.cs

示例13: AspNetForm

        internal AspNetForm(string requestVirtualPath, string queryString, IWebElement formWebElement)
        {
            _formWebElement = formWebElement;
            // form's method
            string formMethod = formWebElement.GetAttribute("method");
            _method = string.IsNullOrEmpty(formMethod) ? "POST" : formMethod;

            // form's action
            string formAction = formWebElement.GetAttribute("action");
            string requestUrl = string.IsNullOrEmpty(queryString) ? requestVirtualPath : requestVirtualPath + "?" + queryString;
            _action = string.IsNullOrEmpty(formAction)
                         ? requestUrl
                         : VirtualPathUtility.Combine(requestVirtualPath, formAction);

            // populate the dictionary with form fields
            RetrieveFormFields(formWebElement);
        }
开发者ID:StuartGreenhall,项目名称:plasma,代码行数:17,代码来源:AspNetForm.cs

示例14: Matches

 public virtual bool Matches(IWebElement element)
 {
     // TODO --- Change to psuedo CSS class?  Less repeated logic
     var tagName = element.TagName.ToLower();
     var type = element.GetAttribute("type");
     type = type == null ? null : type.ToLower();
     return tagName == "input" && (type == "text" || type == "password");
 }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:8,代码来源:TextboxElementHandler.cs

示例15: SdkTeaserNotificationSection

 public SdkTeaserNotificationSection(IWebElement section)
     : base(section)
 {
     if (section.GetAttribute("src") != "'app/views/shared/SdkTeaser.html'")
     {
         throw new ArgumentException("The area is not for sdk teaser notifications");
     }
 }
开发者ID:farukc,项目名称:azure-webjobs-sdk-dashboard-tests,代码行数:8,代码来源:SdkTeaserNotificationSection.cs


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