Javascript testing support available
package htmlunitpoc;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
public class HtmlPoc {
public static void main(String[] args) throws Exception {
WebClient wc = new WebClient();
HtmlPage page = (HtmlPage) wc.getPage("http://www.google.com");
HtmlForm form = page.getFormByName("f");
HtmlSubmitInput button = (HtmlSubmitInput) form.getInputByName("btnG");
HtmlPage page2 = (HtmlPage) button.click();
}
}
but I get:
November 17, 2010 15:41:14 com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify WARNING: Outdated content type failed: "text / javascript". BUILD SUCCESSFUL (total time: 4 seconds)
Which does not help, since it does not work like Unit test, and shows Pass / Fail, etc.
I am using netbeans 6.9.1
kamal source
share