From: Brad C. <bc...@bo...> - 2004-03-22 22:07:33
|
At 10:29 AM 3/22/2004, mbr...@vi... wrote: >Hello again. I have been away from the HtmlUnit seen for some months now. I >am now back at writing a test suite for a ASP.NET application. Things have >changed since I last used HtmlUnit. I downloaded the latest sources from CVS >and found that much of my old code doesn't compile anymore. In >particular, the >method HtmlPage.getOneHtmlElementByAttribute() is gone. What is it's >replacement? Some of HtmlPage's functionality was moved due to some DOM changes (I don't understand most of it myself). If you can't find something that used to be on HtmlPage look under HtmlPage.getDocumentElement(). Your method is: HtmlPage.getDocumentElement().getOneHtmlElementByAttribute(...) >I see some classes with "xpath" in their name. Does HtmlUnit now >have xpath support? I'm sorry if this is a FAQ, but I didn't find >anything in >the list archive. Yes it does. Here's an example (for you and the archive :p): final HtmlUnitXPath xpath = new HtmlUnitXPath(xpathExpression); HtmlElement element = (HtmlElement) xpath.selectSingleNode(currentHtmlPage); >I also found that I had to download maven and add the following jars to the >classpath to get the source to compile using JBuilder. >... I never did...all the jelly stuff just fails for me. One of these days I might add it to the ant build.xml, but I think I'd rather see good maven support in Eclipse :) >One last thing, which is also an issue with 1.2.3, is that >HtmlImageInput.click >() does not cause the enclosing form to get posted. I had to call >HtmlImageInput.click(0,0). Is this by design? The code looks like it will submit either way now. Try the nightly build and log a bug if it doesn't. >I have not had time to create a nice test case, but I have found that in >general HtmlUnit cannot deal with ASP.NET Validators (e.g. >System.Web.UI.WebControls.CompareValidator). HtmlUnit blows up in the >JavaScript produced by ASP.NET. Try the nightly build first, but if that doesn't help can you provide more information about the javascript? I don't have an ASP.NET project to play with. Brad C |