Skip to content

Commit

Permalink
correct the check for value attribute (#2329)
Browse files Browse the repository at this point in the history
Co-authored-by: V. Mark Lehky <[email protected]>
  • Loading branch information
SiKing and V. Mark Lehky authored Dec 4, 2020
1 parent ddef7e3 commit 82ed063
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1094,12 +1094,8 @@ private void throwShouldBePresentErrorWithCauseIfPresent(final Throwable timeout
throw new ElementShouldBePresentException(finalMessage, timeout);
}

private static final List<String> HTML_ELEMENTS_WITH_VALUE_ATTRIBUTE = Arrays.asList("input", "button", "option", "textarea");

private boolean hasValueAttribute(WebElement element) {
String tag = element.getTagName().toLowerCase();
return HTML_ELEMENTS_WITH_VALUE_ATTRIBUTE.contains(tag);

return element.getAttribute("value") != null;
}

@Override
Expand Down

2 comments on commit 82ed063

@Rajkumar2636
Copy link

@Rajkumar2636 Rajkumar2636 commented on 82ed063 May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SiKing and @wakaleo - After serenity update, we noticed that getTextValue() methods returns "0" (zero) for the places where value attribute is not there for the web element. It is affecting all the places where we don't have value attribute. can you please help on this.

However the condition only checks for null, that's the reason for this.
image
image
@findby(xpath = "//li[contains(text(),'zero balance.')]")

@wakaleo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't reproduce this with version 3.2.5

Please sign in to comment.