本文整理汇总了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");
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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);
}
示例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));
}
示例7: ParseSpecClasses
static IEnumerable<string> ParseSpecClasses(IWebElement resultMessage)
{
return resultMessage
.GetAttribute("class")
.Split(' ')
.Where(c => c != "resultMessage" && c != "specDetail" && c != "specSummary");
}
示例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());
}
}
示例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);
}
示例10: BrokenImages
//Broken Images
public void BrokenImages(IWebElement ele)
{
string str = ele.GetAttribute("src");
if (str.EndsWith(".jpg"))
Console.WriteLine("Pass");
else
Assert.Fail();
}
示例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);
}
}
示例12: TestDidPass
public bool TestDidPass(IWebElement testElement) {
try {
return testElement.GetAttribute("class") == "pass";
}
catch(NoSuchElementException) {
return false;
}
}
示例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);
}
示例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");
}
示例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");
}
}