From: Jeff W. <je...@cs...> - 2016-09-04 22:15:21
|
I have a website I am trying to process data on that uses javascript (and AJAX I think). The page appears to be a simple form (that I've included the asXML() from here as an attachment). There are two select fields I am setting and then trying to clock the search button that activates the form but it seems to be reacting as though no selection was performed or that is failing to update the page contents somehow. The client is configured with: webclient = new WebClient(BrowserVersion.FIREFOX_45); webclient.getCookieManager().setCookiesEnabled(true); webclient.getOptions().setJavaScriptEnabled(true); webclient.getOptions().setCssEnabled(true); webclient.getOptions().setUseInsecureSSL(false); webclient.getOptions().setThrowExceptionOnFailingStatusCode(false); webclient.setAjaxController(new NicelyResynchronizingAjaxController()); webclient.getOptions().setThrowExceptionOnScriptError(true); webclient.setCssErrorHandler(new SilentCssErrorHandler()); So I think I am not having an AJAX synchronization problem (And I've put in a hard wait(5000) just after the desired anchor click() just in case). I am setting my selections with: HtmlSelect select = (HtmlSelect)page.getElementById("NR_SSS_SOC_NWRK_STRM"); HtmlOption option = select.getOptionByText(session); select.setSelectedAttribute(option, true); select.fireEvent(Event.TYPE_CHANGE); select = (HtmlSelect)page.getElementById("NR_SSS_SOC_NWRK_SUBJECT"); option = select.getOptionByText(major); select.setSelectedAttribute(option, true); select.fireEvent(Event.TYPE_CHANGE); HtmlAnchor quickanchor = page.getAnchorByText("Quick Search"); page = quickanchor.click(); But this doesn't seem to work. The page I get back doesn't have any new information on it and it appears as though none of the selections have changed (I don't know if selection changes would appear as rendered differences though in the saved XML) (I've also attached a copy of the asXML() for the returned page from the click.) I discovered the fireEvent for onchange when doing web research into the problem but adding that to the select usage hasn't changed/improved anything. All I seem to be able to get from quickanchor.click() is an unchanged page. And I'm too ignorant about javascript/AJAX to know if the necessary pieces are even being called/activated or if there is a successful AJAX call to the server and back taking place. So... Can anybody tell me what is going on or what I need to do differently to get this to work? Thank you. Jeff |