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
Icons and Start menu disappeared from desktop, running Windows 7 Home Edition on a Dell
Linq and new features design in VS 2008
Trusted Location Error Message "2001"
GPO Assign Application reinstall
Windows XP Taskbar won't auto-hide
offline server ,active director
Can anyone guide me how to download MEMO software back to N900 ?
Teaching iPhone app creation...Any advice?
Operator '=' is not defined for type 'DBNull' and type 'Integer' - how to fix
Mirror Hard Drive