Hi Dao, I don't think SVG is supported by HTMLUnit. See [1].
Regards, Julien [1] http://sourceforge.net/tracker/index.php?func=detail&aid=3313921&group_id=47038&atid=448266 >________________________________ >De : dao <dao.ho...@gmail.com> >À : jwebunit-users@lists.sourceforge.net >Envoyé le : Dimanche 30 Octobre 2011 8h10 >Objet : [JWebUnit-users] script is not executing when required > > >hello, > > >I am new in jwebunit, I am faced to a strange behavior. I have a script like >this: > > ><object type="image/svg+xml" data="mySvg.svg" id="svgFigure" >style="display:inline;"></object> >><script> >>//once the SVG is loaded, we create the SVG analysis >>$(window).load(function () { >> var a = document.getElementById("svgFigure"); >> var svgDoc = a.contentDocument; //get the inner DOM of alpha.svg >> //access the svg dom tree. In my browser, svgDoc is not null. With >>jwebunit, it is null. >> });</script> >> > >In my browser, svgDoc is not null. With jwebunit, it is null. It seems that >the function the function is called before the svg object is loaded. > > >How can I handle it? > > >here is my test code snippet: >public class DashboardTest extends FunctionalTest { >>private WebTester w; >>@Before >> public void prepare() { >>w = new WebTester(); >>Fixtures.deleteDatabase(); >>Fixtures.loadModels("initEmpty.yaml"); >> w.setBaseUrl("http://localhost:9000/";); >> } >> >> >>@Test >>public void addDashboard() { >> //log as user >> w.beginAt("login"); >> if (w.getTestingEngine() instanceof HtmlUnitTestingEngineImpl) >> { >> //((HtmlUnitTestingEngineImpl) >>w.getTestingEngine()).getWebClient().setThrowExceptionOnScriptError(false); >> //((HtmlUnitTestingEngineImpl) >>w.getTestingEngine()).getWebClient().setAjaxController(new >>NicelyResynchronizingAjaxController()); >> } >> >> >> //check the AC list is fetch OK. >> w.setTextField("username", "dao.ho...@gmail.com"); >> w.setTextField("password", "xxx"); >> w.clickButton("signin"); >> w.clickLink("dashboardList"); >> w.clickLink("newDashboard"); >> w.assertTitleEquals("flightwatching - edit dashboard"); >>} > > >-- >Dao Hodac > >------------------------------------------------------------------------------ >Get your Android app more play: Bring it to the BlackBerry PlayBook >in minutes. BlackBerry App World™ now supports Android™ Apps >for the BlackBerry® PlayBook™. Discover just how easy and simple >it is! http://p.sf.net/sfu/android-dev2dev > >_______________________________________________ >JWebUnit-users mailing list >JWebUnit-users@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/jwebunit-users > > > ------------------------------------------------------------------------------ Get your Android app more play: Bring it to the BlackBerry PlayBook in minutes. BlackBerry App World™ now supports Android™ Apps for the BlackBerry® PlayBook™. Discover just how easy and simple it is! http://p.sf.net/sfu/android-dev2dev _______________________________________________ JWebUnit-users mailing list JWebUnit-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-users