|
86 | 86 | import org.openqa.selenium.interactions.HasInputDevices;
|
87 | 87 | import org.openqa.selenium.interactions.Keyboard;
|
88 | 88 | import org.openqa.selenium.interactions.Mouse;
|
| 89 | +import org.openqa.selenium.internal.FindsByClassName; |
89 | 90 | import org.openqa.selenium.internal.FindsByCssSelector;
|
90 | 91 | import org.openqa.selenium.internal.FindsById;
|
91 | 92 | import org.openqa.selenium.internal.FindsByLinkText;
|
|
119 | 120 |
|
120 | 121 | public class HtmlUnitDriver implements WebDriver, JavascriptExecutor,
|
121 | 122 | FindsById, FindsByLinkText, FindsByXPath, FindsByName, FindsByCssSelector,
|
122 |
| - FindsByTagName, HasCapabilities, HasInputDevices { |
| 123 | + FindsByTagName, FindsByClassName, HasCapabilities, HasInputDevices { |
123 | 124 |
|
124 | 125 | private WebClient webClient;
|
125 | 126 | private WebWindow currentWindow;
|
@@ -914,6 +915,16 @@ public List<WebElement> findElementsById(String id) {
|
914 | 915 | return findElementsByXPath("//*[@id='" + id + "']");
|
915 | 916 | }
|
916 | 917 |
|
| 918 | + @Override |
| 919 | + public WebElement findElementByClassName(String className) { |
| 920 | + return findElementByCssSelector("." + className); |
| 921 | + } |
| 922 | + |
| 923 | + @Override |
| 924 | + public List<WebElement> findElementsByClassName(String className) { |
| 925 | + return findElementsByCssSelector("." + className); |
| 926 | + } |
| 927 | + |
917 | 928 | public WebElement findElementByCssSelector(String using) {
|
918 | 929 | if (!(lastPage() instanceof HtmlPage)) {
|
919 | 930 | throw new NoSuchElementException("Unable to locate element using css: " + lastPage());
|
|
0 commit comments