Skip to content

Commit

Permalink
Make Select use trimmed text when doing text matching
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Mar 31, 2020
1 parent 9a73dd7 commit 6b4e0f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion java/client/src/org/openqa/selenium/support/ui/Select.java
Expand Up @@ -133,8 +133,11 @@ public void selectByVisibleText(String text) {
element.findElements(By.xpath(".//option[contains(., " +
Quotes.escape(subStringWithoutSpace) + ")]"));
}

String trimmed = text.trim();

for (WebElement option : candidates) {
if (text.equals(option.getText())) {
if (trimmed.equals(option.getText().trim())) {
setSelected(option, true);
if (!isMultiple()) {
return;
Expand Down

0 comments on commit 6b4e0f6

Please sign in to comment.