Skip to content

Commit

Permalink
Fixing HtmlUnit driver to pass recently added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Jan 25, 2016
1 parent b0aebbb commit 9312fa1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions java/client/src/org/openqa/selenium/htmlunit/HtmlUnitDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -1102,12 +1102,12 @@ public WebElement findElementByName(String name) {
}

@Override
public List<WebElement> findElementsByName(String using) {
public List<WebElement> findElementsByName(String name) {
if (!(lastPage() instanceof HtmlPage)) {
return new ArrayList<>();
}

List<DomElement> allElements = ((HtmlPage) lastPage()).getElementsByName(using);
List<DomElement> allElements = ((HtmlPage) lastPage()).getElementsByName(name);
return convertRawHtmlElementsToWebElements(allElements);
}

Expand All @@ -1126,12 +1126,16 @@ public WebElement findElementByTagName(String name) {
}

@Override
public List<WebElement> findElementsByTagName(String using) {
public List<WebElement> findElementsByTagName(String name) {
if ("".equals(name)) {
throw new InvalidSelectorException("Unable to locate element by xpath for " + lastPage());
}

if (!(lastPage() instanceof HtmlPage)) {
return new ArrayList<>();
}

NodeList allElements = ((HtmlPage) lastPage()).getElementsByTagName(using);
NodeList allElements = ((HtmlPage) lastPage()).getElementsByTagName(name);
List<WebElement> toReturn = new ArrayList<>(allElements.getLength());
for (int i = 0; i < allElements.getLength(); i++) {
Node item = allElements.item(i);
Expand Down
2 changes: 1 addition & 1 deletion java/client/test/org/openqa/selenium/TypingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ public void canSafelyTypeOnElementThatIsRemovedFromTheDomOnKeyPress() {
}

@Test
@NotYetImplemented({CHROME})
@NotYetImplemented({CHROME, HTMLUNIT})
public void canClearNumberInputAfterTypingInvalidInput() {
driver.get(pages.formPage);
WebElement input = driver.findElement(By.id("age"));
Expand Down

0 comments on commit 9312fa1

Please sign in to comment.