Skip to content

Commit

Permalink
vmi#173 workaround for InvalidSelectorError: Compound class names no…
Browse files Browse the repository at this point in the history
…t permitted
  • Loading branch information
deki committed Dec 14, 2015
1 parent 1225de9 commit e97a40b
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -3,6 +3,7 @@

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand All @@ -16,6 +17,13 @@ public String locatorType() {

@Override
public List<WebElement> handle(WebDriver driver, String arg) {
return driver.findElements(By.className(arg));
By by;
if (StringUtils.contains(arg, StringUtils.SPACE)) {
//avoid InvalidSelectorError: Compound class names not permitted
by = By.cssSelector("." + StringUtils.replace(arg, StringUtils.SPACE, "."));
} else {
by = By.className(arg);
}
return driver.findElements(by);
}
}

0 comments on commit e97a40b

Please sign in to comment.