Hi
I am testing the following code to download a webpage from wikipedia.
and it generates a long exception as shown below. Any ideas much
appreciated!
Thanks
Code:
-------------
final WebClient webClient =new WebClient();
try {
final HtmlPage page = webClient.getPage("https://en.wikipedia.org/wiki/Commedia_all%27italiana");
page.save(new File("blah/saved.html"));
System.out.println();
}catch (Exception e){
e.printStackTrace();
}
----------------------
Exception:
2016-07-11 16:58:37 ERROR StrictErrorReporter:82 - runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[https://en.wikipedia.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=QIEfZWVM] line=[16] lineSource=[null] lineOffset=[0]
2016-07-11 16:58:37 ERROR WebConsole:442 - TypeError: Expected argument of type object, but instead had type object TypeError: Expected argument of type object, but instead had type object
org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:183)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1351)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1268)
at com.gargoylesoftware.htmlunit.html.HtmlLink.getWebResponse(HtmlLink.java:185)
at com.gargoylesoftware.htmlunit.html.HtmlLink.getWebResponse(HtmlLink.java:166)
at com.gargoylesoftware.htmlunit.html.XmlSerializer.getAttributesFor(XmlSerializer.java:210)
at com.gargoylesoftware.htmlunit.html.XmlSerializer.readAttributes(XmlSerializer.java:138)
at com.gargoylesoftware.htmlunit.html.XmlSerializer.printOpeningTag(XmlSerializer.java:121)
at com.gargoylesoftware.htmlunit.html.XmlSerializer.printXml(XmlSerializer.java:91)
at com.gargoylesoftware.htmlunit.html.XmlSerializer.printXml(XmlSerializer.java:101)
at com.gargoylesoftware.htmlunit.html.XmlSerializer.printXml(XmlSerializer.java:101)
at com.gargoylesoftware.htmlunit.html.XmlSerializer.asXml(XmlSerializer.java:81)
at com.gargoylesoftware.htmlunit.html.XmlSerializer.save(XmlSerializer.java:62)
at com.gargoylesoftware.htmlunit.html.HtmlPage.save(HtmlPage.java:2167)
at uk.ac.shef.dcs.sti.ui.InputFilePreview.main(InputFilePreview.java:21)
Caused by: org.apache.http.HttpException: android-app protocol is not supported
at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:88)
at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:183)
... 16 more
|