[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit WebPageTest.java,1.32,1.33
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-08-27 02:16:10
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv18415/test/com/meterware/httpunit
Modified Files:
WebPageTest.java
Log Message:
Support search by attribute
Index: WebPageTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- WebPageTest.java 6 Jul 2003 13:20:09 -0000 1.32
+++ WebPageTest.java 27 Aug 2003 02:16:06 -0000 1.33
@@ -464,4 +464,21 @@
assertImplement( "element with name 'aForm'", simplePage.getElementsWithName( "aForm" ), WebForm.class );
assertImplement( "element with name 'color'", simplePage.getElementsWithName( "color" ), FormControl.class );
}
+
+
+ public void testGetElementsByAttribute() throws Exception {
+ defineResource( "SimplePage.html",
+ "<html><head><title>A Sample Page</title></head>\n" +
+ "<body><form class='first' name='aForm'><input name=color></form>" +
+ "have <a id='link1' href='/other.html'>an <b>active</b> link</A>\n" +
+ "<img id='23' src='/images/arrow.gif' ALT='Next -->' WIDTH=1 HEIGHT=4>\n" +
+ "</body></html>\n" );
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" );
+ WebResponse simplePage = wc.getResponse( request );
+ assertImplement( "elements with class 'first'", simplePage.getElementsWithAttribute( "class", "first" ), WebForm.class );
+ assertImplement( "elements with name 'color'", simplePage.getElementsWithAttribute( "name", "color" ), FormControl.class );
+ assertImplement( "elements with id 'link1'", simplePage.getElementsWithAttribute( "id", "link1" ), WebLink.class );
+ assertImplement( "elements with src '/images/arrow.gif'", simplePage.getElementsWithAttribute( "src", "/images/arrow.gif" ), WebImage.class );
+ }
}
|