Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HtmlUnitDriver does not evaluate CSS3 pseudo class :target correctly #46

Closed
lklonowski opened this issue Mar 17, 2017 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@lklonowski
Copy link

When accessing a website with an anchor, CSS styles for a matching :target do not apply as expected.

Minimal test site:

<!DOCTYPE html>
<html>
<head>
<style>
.tab div {
    display: none;
}

.tab div:target {
    display: block;
}
</style>
</head>
<body>
<div class="tab">
<a id="link" href="#anchor">Link</a>   
<div id="anchor">
  <p>Content</p>
</div>
</div>
</body>
</html>

Minimal Java test code:

getWebDriver().get(TEST_URL);
getWebDriver().findElement(By.id("link")).click();
System.out.println(getWebDriver().findElement(By.id("anchor")).isDisplayed());
getWebDriver().get(TEST_URL + "#anchor");
System.out.println(getWebDriver().findElement(By.id("anchor")).isDisplayed());

Result:
Both times 'false' ist printed.

@asashour asashour self-assigned this Mar 17, 2017
@asashour asashour added the bug label Mar 17, 2017
@asashour asashour added this to the 2.26 milestone Mar 17, 2017
@asashour
Copy link
Contributor

Thanks for reporting, fixed in HtmlUnit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants