Hello, We're using JWebUnit 3 to test a JSF web application that uses JBoss RichFaces AJAX enabled components.
At one point in the test, a call to clickElementByXPath("//tr[@id='genTabViewId:genTabFrm:availableGroups:source::0']") is made but it fails with this: java.lang.AssertionError: Unable to locate element with xpath "//tr[@id='genTabViewId:genTabFrm:availableGroups:source::0']" at org.junit.Assert.fail(Assert.java:91) at org.junit.Assert.assertTrue(Assert.java:43) at net.sourceforge.jwebunit.junit.WebTester.assertElementPresentByXPath(WebTester.java:2109) at net.sourceforge.jwebunit.junit.WebTester.clickElementByXPath(WebTester.java:2673) at com.xyz.util.EnrollmentUtil.setGeneralTabFields(EnrollmentUtil.java:165) ... Just before making the clickElementByXPath call, we execute Thread.sleep(5000) to account for AJAX activity and then we dump the page content two ways to see what's going on: [1] FileUtils.writeStringToFile(new File(filename), getPageSource()); and [2] HtmlUnitTestingEngineImpl engine = (HtmlUnitTestingEngineImpl) getTestingEngine(); HtmlPage page = ((HtmlPage) engine.getCurrentWindow().getEnclosedPage()); FileUtils.writeStringToFile(new File(filename), page.asXml()); The dumps are different which is quite surprising. When viewing the file generated by method [1] in Chrome, the "tr" element is not present. But it is present when viewing the file generated by method [2]. What is happening? The contents contained herein may contain confidential information. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, printing or action taken on the contents is strictly prohibited. If you have received this email in error, please notify the sender immediately and delete this message. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ JWebUnit-users mailing list JWebUnit-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-users