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
average overhead on a PIX site to site IPSec tunnel
excel string functions
Dialog.ModalityType.APPLIC
ATION_MODA
L
Inserting data into a varbinary(max) field
Ubuntu - Vista
Using VLookup for Data Validation
Do WPF and MVP go together?
The marquee progressbar hangs as the next line of the code executes
How deploy a website shortcut to 200 users desktop
VB script to uninstall with admin rights.