Microsoft
Software
Hardware
Network
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.htmlu
nit.*;
import com.gargoylesoftware.htmlu
nit.html.H
tmlPage;
import java.util.List;
public class FirtHtmlUnitAttempt extends TestCase {
public static void main(String[] args) {
HtmlPage page = getPage("
http://cbrint78/d
ms_test_ne
w_code/Pro
jectsDisc.
aspx?id=17
26
");
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.htmlu
nit.html.H
tmlPage;' 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.FirtHtmlUnitAtt
empt.main(
FirtHtmlUn
itAttempt.
java:20)
How do I open a web page with HtmlUnit then?
Thank you,
Ana
Related Solutions:
HtmlUnit to test webpages
Answer : HtmlUnit
try using this method instyead
http://htmlunit.sourceforg
e.net/apid
ocs/com/ga
rgoylesoft
ware/
htmlu
nit/
Defaul
tCredentia
lsProvider
.html#addN
TLMCredent
ials(java.
lang.Strin
g,%20java.
lang.Strin
g,%20java.
lang.Strin
g,%20int,%
20java.lan
g.String,%
20java.lan
g.String)
Random Solutions
Passing PChar parm to DLL
Please wait while Windows configures Crystal Reports Release 2
C# asp.net - Set object visibility based on browser type
HTML Cellindex showing wrong index while display:none
jQuery tooltip on form input image hover
Microsoft Information Store stalling issues
PHP Warning: Cannot modify header information
Multiple Dll's in Delphi
DAG & CAS array configured but it's not failover
Export data from a ODBC table