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
How do I add buttons on a PDF form to add/remove rows of data?
PowerPoint 2007 Printing issues - shadows and text boxes
Access 2003/2007 background colour
How can I connect printer to a computer using another computer.
Microsoft Virtual Environment - SQL Server 2005/SQL Server 2008
Deleting Unmatched Records MS Acess 2000
Video Chat Capabilities
Store file in mysql using connector.net and blob field
Windows Server 2008 R2 iSCSI Initiator and HP D2D CHAP issue
Two SCCM primary site in active directory