From: Tomek S. <tom...@go...> - 2009-09-24 14:36:00
|
Hi, thanks for a quick answer. Yes the page should be updated, I mean the current page will be updated by Ajax, so I expect my reference to the page is up to date. Maybe was the example not clear, i am waiting for Ajax is complete. Here a more real example with my workaround: for (Entry<String, Integer> entry : testValues.entrySet()) { final HtmlTextInput field = page.getFirstByXPath(fieldXpath); final String label = field.getAttribute("wicketpath"); final String fieldId = field.getId(); HtmlTextInput current = (HtmlTextInput) page.getElementById(fieldId); current.setValueAttribute(entry.getKey().toString()); PageUtil.getApplyButton(page).click(); page = (HtmlPage) page.refresh(); TestUtil.waitForTableLoaded(page, 10000); final List<HtmlListItem> resultList = AllJobViewsPageUtil.getResultList(page); final Integer expected = entry.getValue(); assertEquals("Result for " + label + " with value " + entry.getKey(), expected.intValue(), resultList.size()); } When I remove the line with page.refresh() I've got a page with old result values. I'm not sure, if this is only a HtmlUnit problem, because we have the problems since we updated wicket, but also on the wicket side I couldn't find what exactly is the problem. Tomek 2009/9/24 Marc Guillemot <mgu...@ya...> > Hi, > > the definition of the page returned by actions like click is weak and > not very consistent in HtmlUnit-2.6. > > What should happen? Should the current page be updated? Shouldn't you > wait for some asynchron actions to complete before to evaluate the XPath? > > Cheers, > Marc. > -- > Web: http://www.efficient-webtesting.com > Blog: http://mguillem.wordpress.com > > Tomek Sniadach wrote: > > Hi UG, > > I have currently problem with an ajax submit button. It seems to be a > > problem with form submitting. > > Here a sample code: > > > > HtmlPage page = client.getPage(request); > > HtmlButton btn = getSubmitButton(page); > > ... > > btn.click(); > > List results = page.getByXpath("xpath to my filter results"); > > > > > > The problem is that the page isn't updated. When I write page = > > page.refresh(); after btn.click() it works fine, but it should not be > > necessary. I've debugged a little and found in HtmlPage.java > > (994) return new ScriptResult(result, > > getWebClient().getCurrentWindow().getEnclosedPage()); > > where getEnclosedPage the page "about:blank" returns. I'm not sure this > > is the problem here, but when I make ajax the paeg should be the same. > > Does anyone has any idea how to solve the problem? > > > > greets > > Tomek > > > > ps. The application is using wicket (1.4.1) and HtmlUnit (2.6) > > > > > > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |