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
Migrate SBS 2003 to Hyper-V
Can't access Exchange 2003 OWA from Internet
How to compress a string into a short representation in ASP.NET using C# or VB.NET?
is it possible virus affected VPN client spread virus in corporate network?
How to get the text from jsp file to database?
Remote Web Workplace different website address
stop error oxoooooo7b(OxF78D2524,OxC0
000034 will not load XP setup!!!!!!!
HP PSC 2110 won't print - just blank page
Manually move Exchange 2003 mailstore to different disk
sysstat ntbackup problem "Registry Writer" has reported an error 0x800423f1