Place the jniwrap.dll into your system32 folder (Typically C:/WINDOWS/system32/)
Open your favorite IDE and create a project...our favorite is IntelliJ
Include watij.jar and all the jars in the lib folder in your classpath
Create a Junit TestCase and make sure you include “import static watij.finders.SymbolFactory.\*;”
Try out the simple example test below!
public class GoogleTest extends TestCase {
public void testGoogleSearch() throws Exception {
IE ie = new IE();
ie.start("http://www.google.com");
ie.textField(name,"q").set("XWiki");
ie.button("Google Search").click();
assertTrue(ie.containsText("/Java wiki engine/"));
}
}
评论