Hi,
I have a problem with a JavaScript redirect and get the following message:
INFO: Redirect requested but followRedirects is disabled
My JavaScript/HTML source is (simplified):
<script type="text/javascript">
function redirect()
{
document.location.href = "otherpage.html";
}
</script>
<a href="javascript:redirect();" name="redirect">link</a>
and my test method looks like:
public void testRedirect() throws Exception
{
WebClient webClient = new WebClient(BrowserVersion.FULL_FEATURED_BROWSER);
webClient.setRedirectEnabled(true);
URL url = new URL("http://localhost/myfile");
HtmlPage page = (HtmlPage)webClient.getPage(url);
HtmlPage newPage = (HtmlPage)page.getAnchorByName("redirect").click();
assertEquals("Title", newPage.getTitleText());
}
Am I doing something wrong? Or is it a bug?
Thanks,
Daniel
|