Permalink
Browse files

now checks for button element along with inout tyoe button

  • Loading branch information...
1 parent 16b702c commit c4d12397306d852726d9a46cd5d37be74f969c50 @shashankshetty shashankshetty committed Jan 26, 2014
@@ -101,16 +101,22 @@ public ButtonWrapper ButtonWithId(string id)
public ButtonWrapper ButtonWithText(string text)
{
const string howFound = "button with visible text '{0}'";
- var button = Buttons().FirstOrDefault(x => x.Element.GetAttribute("value") == text);
+ var button = Buttons().FirstOrDefault(x =>
+ {
+ var buttonText = x.Element.TagName == "button" ? x.Element.Text : x.Element.GetAttribute("value");
+ return buttonText == text;
+ });
return new ButtonWrapper(button == null ? null : button.Element, String.Format(howFound, text), this);
}
public IEnumerable<ButtonWrapper> Buttons()
{
const string howFound = "type 'button'";
- return from input in GetInputs().AsParallel()
- where IsButton(input)
- select new ButtonWrapper(input, howFound, this);
+ var inputWrappers = GetInputs().Where(IsButton).Select(input => new ButtonWrapper(input, howFound, this)).ToList();
+ var elementsByTagType = GetElementsByTagType("button");
+ var buttonWrappers = elementsByTagType.Select(button => new ButtonWrapper(button, howFound, this)).ToList();
+ inputWrappers.AddRange(buttonWrappers);
+ return inputWrappers;
}
public IEnumerable<ButtonWrapper> ButtonsWithClassName(string className)
@@ -18,7 +18,7 @@ public string Text
{
if (_text == null)
{
- _text = Element.GetAttribute("value");
+ _text = Element.TagName == "button" ? Element.Text : Element.GetAttribute("value");
}
return new ReadOnlyText("value of " + HowFound, _text);
}

0 comments on commit c4d1239

Please sign in to comment.