Question : HtmlUnit

I'm trying to test web pages with HtmlUnit and Junit. I use the Eclipse IDE.

I've written this code:

import junit.framework.*;
import com.gargoylesoftware.htmlunit.*;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import java.util.List;


public class FirtHtmlUnitAttempt extends TestCase {
public static void main(String[] args) {
                              
            HtmlPage page = getPage("http://cbrint78/dms_test_new_code/ProjectsDisc.aspx?id=1726");
            assertNotNull("Page hasn't been found.", page);
            System.out.println("Found Siemens Projects page");

But it doesn't work,  the getPage method is not recognized. I can't understand why because I've already included the  'import com.gargoylesoftware.htmlunit.html.HtmlPage;' statemente. This is the error message I get:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method getPage(String) is undefined for the type FirtHtmlUnitAttempt
at firstTrial.FirtHtmlUnitAttempt.main(FirtHtmlUnitAttempt.java:20)

How do I open a web page with HtmlUnit then?

Thank you,

Ana
Related Solutions: HtmlUnit to test webpages

Answer : HtmlUnit

Random Solutions  
 
programming4us programming4us