javascript - Java HtmlUnit click on anchor link does not work. How do I get the new page? -
i'm trying click on "more" anchor tag on website using htmlunit in order expand list until more anchor tag not exist.
page = client.getpage(url); htmlanchor anchor; while((anchor = page.getfirstbyxpath("//a[@class='load-more list']")) != null) { page = (htmlpage) anchor.getpage(); }
i've tried page = anchor.click();
system.out.println(anchor)
shows
htmlanchor[ href="/guideitem/list/?id=g407&requesttype=browse&filter=zmlsdgvypxmlm2fmcmvljmxpbwl0ptmw" class="load-more list" data-hijax="false" ]
i continue problem , post find here.
i've had similar problem, hope helps. "solved itself" after disabled css on webclient:
webclient.getoptions().setcssenabled(false);
my anchor was:
<div class="my-anchors-parent-class"/> <a href="javascript:void(0) class="text" id="buttonsearch" style="display: block;">search</a> </div>
it had jquery attaching .click() handler it, acted based on 'class' property of anchor's parent:
$('.my-anchor's-parent-class').each(function () { $(this).children('a').click(function () { // if parent has given class appended, call .myfunction(this) // else, call other function }); });
when reenable css, .click() broken again.
Comments
Post a Comment