I wanted to execute an Anchor using .click() method by getting the Anchor using getAnchorByHref that contains javascript code to go to another page. Here's my snippet below. But running this code gives me.
ElementNotFoundException: elementName=[a] attributeName=[href] attributeValue=[javascript:submit('ActivityForm.jsp')]
try{
HtmlPage currentPage = client.getWebClient().getPage("url");
HtmlAnchor createOrder = (HtmlAnchor) currentPage.getAnchorByHref("javascript:submit('ActivityForm.jsp')");
createOrder.click();
}
catch(FailingHttpStatusCodeException | IOException e){
e.printStackTrace();
}