From: John S. <tra...@gm...> - 2005-07-11 06:02:19
|
I don't have a specific question per se. However, I am concerned about HTMLUnit's behavior when I attempt to access ebay.com: Code ------------------ import java.net.URL; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class Test { public static void main( String[] args ) { try { WebClient webClient =3D new WebClient(); webClient.setRedirectEnabled( true ); =20 HtmlPage page =3D ( HtmlPage ) webClient.getPage( new URL( "http://www.ebay.com" ) ); if ( page !=3D null ) { System.out.println( page.asXml() ); } } catch ( Exception e ) { System.err.println( "Exception: " + e.getMessage() ); e.printStackTrace(); } } } Output ------------------ > java Test Jul 11, 2005 1:51:59 AM com.gargoylesoftware.htmlunit.javascript.host.Document jsxSet_cookie INFO: Added cookie: ebay=3D%5Edv%3D42d208ff%5E Jul 11, 2005 1:52:00 AM com.gargoylesoftware.htmlunit.javascript.host.Document jsxSet_cookie INFO: Added cookie: ebay=3D%5Edv%3D42d20900%5E Jul 11, 2005 1:52:04 AM com.gargoylesoftware.htmlunit.javascript.host.Document jsxSet_cookie INFO: Added cookie: lucky9=3D626637 Exception in thread "main" java.lang.StackOverflowError at java.net.URLStreamHandler.parseURL(Unknown Source) at sun.net.www.protocol.file.Handler.parseURL(Unknown Source) at java.net.URL.<init>(Unknown Source) at java.net.URL.<init>(Unknown Source) at sun.misc.URLClassPath$FileLoader.getResource(Unknown Source) at sun.misc.URLClassPath$FileLoader.findResource(Unknown Source) at sun.misc.URLClassPath.findResource(Unknown Source) at java.net.URLClassLoader$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findResource(Unknown Source) at java.lang.ClassLoader.getResource(Unknown Source) at java.lang.ClassLoader.getResourceAsStream(Unknown Source) at java.util.ResourceBundle$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.util.ResourceBundle.loadBundle(Unknown Source) at java.util.ResourceBundle.findBundle(Unknown Source) at java.util.ResourceBundle.getBundleImpl(Unknown Source) at java.util.ResourceBundle.getBundle(Unknown Source) at java.util.logging.Level.getLocalizedName(Unknown Source) at java.util.logging.SimpleFormatter.format(Unknown Source) at java.util.logging.StreamHandler.publish(Unknown Source) at java.util.logging.ConsoleHandler.publish(Unknown Source) at java.util.logging.Logger.log(Unknown Source) at java.util.logging.Logger.doLog(Unknown Source) at java.util.logging.Logger.logp(Unknown Source) at org.apache.commons.logging.impl.Jdk14Logger.log(Jdk14Logger.java= :91) at org.apache.commons.logging.impl.Jdk14Logger.error(Jdk14Logger.ja= va:119) at com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.run= timeError(StrictErrorReporter.java:113) at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1= 054) at org.mozilla.javascript.Parser.parse(Parser.java:354) at org.mozilla.javascript.Parser.parse(Parser.java:287) at org.mozilla.javascript.Context.compileImpl(Context.java:2349) at org.mozilla.javascript.Context.compileString(Context.java:1372) at org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.j= ava:2202) at org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.j= ava:2071) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:29= 22) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:21= 64) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunct= ion.java:140) at org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.j= ava:2217) at org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.j= ava:2071) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:29= 22) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:21= 64) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunct= ion.java:140) at org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.j= ava:2217) at org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.j= ava:2071) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:29= 22) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:21= 64) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunct= ion.java:140) at org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.j= ava:2217) at org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.j= ava:2071) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:29= 22) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:21= 64) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunct= ion.java:140) at org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.j= ava:2217) at org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.j= ava:2071) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:29= 22) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:21= 64) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunct= ion.java:140) at org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.j= ava:2217) at org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.j= ava:2071) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:29= 22) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:21= 64) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunct= ion.java:140) at org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.j= ava:2217) ... * Note: The last five stack trace lines keep repeating (hence the ...) Does anyone have any suggestions or explanations? Thanks. |
From: David D. K. <ddk...@ki...> - 2005-07-15 14:54:13
|
It's probably a missing (or misimplemented) JavaScript feature in Htmlunit. Have you tried using a different browser type by passing in a constant to the WebClient constructor to make it look like a different browser? The default is MSIE 6, I believe. Try the Mozilla 1.0 browser to see if it behaves differently. For example, Google's home page returns different JavaScript depending on the browser type. Htmlunit has a "sanity test" as part of its unit tests that hits the home pages of a variety of external web sites. I would recommend filing a bug on SourceForge about this since it seems to be another good external web site to hit. Dave On Jul 11, 2005, at 1:02 AM, John Smith wrote: > I don't have a specific question per se. However, I am concerned > about HTMLUnit's behavior when I attempt to access ebay.com: > > Code > ------------------ > import java.net.URL; > import com.gargoylesoftware.htmlunit.WebClient; > import com.gargoylesoftware.htmlunit.html.HtmlPage; > > public class Test { > > public static void main( String[] args ) { > > try { > > WebClient webClient = new WebClient(); > webClient.setRedirectEnabled( true ); > > HtmlPage page = ( HtmlPage ) webClient.getPage( new URL( > "http://www.ebay.com" ) ); > > if ( page != null ) { > > System.out.println( page.asXml() ); > } > > } catch ( Exception e ) { > > System.err.println( "Exception: " + e.getMessage() ); > e.printStackTrace(); > } > } > } > > Output > ------------------ > >> java Test >> > Jul 11, 2005 1:51:59 AM > com.gargoylesoftware.htmlunit.javascript.host.Document jsxSet_cookie > INFO: Added cookie: ebay=%5Edv%3D42d208ff%5E > Jul 11, 2005 1:52:00 AM > com.gargoylesoftware.htmlunit.javascript.host.Document jsxSet_cookie > INFO: Added cookie: ebay=%5Edv%3D42d20900%5E > Jul 11, 2005 1:52:04 AM > com.gargoylesoftware.htmlunit.javascript.host.Document jsxSet_cookie > INFO: Added cookie: lucky9=626637 > Exception in thread "main" java.lang.StackOverflowError > at java.net.URLStreamHandler.parseURL(Unknown Source) > at sun.net.www.protocol.file.Handler.parseURL(Unknown Source) > at java.net.URL.<init>(Unknown Source) > at java.net.URL.<init>(Unknown Source) > at sun.misc.URLClassPath$FileLoader.getResource(Unknown > Source) > at sun.misc.URLClassPath$FileLoader.findResource(Unknown > Source) > at sun.misc.URLClassPath.findResource(Unknown Source) > at java.net.URLClassLoader$2.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findResource(Unknown Source) > at java.lang.ClassLoader.getResource(Unknown Source) > at java.lang.ClassLoader.getResourceAsStream(Unknown Source) > at java.util.ResourceBundle$1.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at java.util.ResourceBundle.loadBundle(Unknown Source) > at java.util.ResourceBundle.findBundle(Unknown Source) > at java.util.ResourceBundle.getBundleImpl(Unknown Source) > at java.util.ResourceBundle.getBundle(Unknown Source) > at java.util.logging.Level.getLocalizedName(Unknown Source) > at java.util.logging.SimpleFormatter.format(Unknown Source) > at java.util.logging.StreamHandler.publish(Unknown Source) > at java.util.logging.ConsoleHandler.publish(Unknown Source) > at java.util.logging.Logger.log(Unknown Source) > at java.util.logging.Logger.doLog(Unknown Source) > at java.util.logging.Logger.logp(Unknown Source) > at org.apache.commons.logging.impl.Jdk14Logger.log > (Jdk14Logger.java:91) > at org.apache.commons.logging.impl.Jdk14Logger.error > (Jdk14Logger.java:119) > at > com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.runtimeEr > ror(StrictErrorReporter.java:113) > at org.mozilla.javascript.Context.reportRuntimeError > (Context.java:1054) > at org.mozilla.javascript.Parser.parse(Parser.java:354) > at org.mozilla.javascript.Parser.parse(Parser.java:287) > at org.mozilla.javascript.Context.compileImpl(Context.java: > 2349) > at org.mozilla.javascript.Context.compileString > (Context.java:1372) > at org.mozilla.javascript.ScriptRuntime.evalSpecial > (ScriptRuntime.java:2202) > at org.mozilla.javascript.ScriptRuntime.callSpecial > (ScriptRuntime.java:2071) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2922) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2164) > at org.mozilla.javascript.InterpretedFunction.call > (InterpretedFunction.java:140) > at org.mozilla.javascript.ScriptRuntime.evalSpecial > (ScriptRuntime.java:2217) > at org.mozilla.javascript.ScriptRuntime.callSpecial > (ScriptRuntime.java:2071) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2922) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2164) > at org.mozilla.javascript.InterpretedFunction.call > (InterpretedFunction.java:140) > at org.mozilla.javascript.ScriptRuntime.evalSpecial > (ScriptRuntime.java:2217) > at org.mozilla.javascript.ScriptRuntime.callSpecial > (ScriptRuntime.java:2071) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2922) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2164) > at org.mozilla.javascript.InterpretedFunction.call > (InterpretedFunction.java:140) > at org.mozilla.javascript.ScriptRuntime.evalSpecial > (ScriptRuntime.java:2217) > at org.mozilla.javascript.ScriptRuntime.callSpecial > (ScriptRuntime.java:2071) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2922) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2164) > at org.mozilla.javascript.InterpretedFunction.call > (InterpretedFunction.java:140) > at org.mozilla.javascript.ScriptRuntime.evalSpecial > (ScriptRuntime.java:2217) > at org.mozilla.javascript.ScriptRuntime.callSpecial > (ScriptRuntime.java:2071) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2922) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2164) > at org.mozilla.javascript.InterpretedFunction.call > (InterpretedFunction.java:140) > at org.mozilla.javascript.ScriptRuntime.evalSpecial > (ScriptRuntime.java:2217) > at org.mozilla.javascript.ScriptRuntime.callSpecial > (ScriptRuntime.java:2071) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2922) > at org.mozilla.javascript.Interpreter.interpret > (Interpreter.java:2164) > at org.mozilla.javascript.InterpretedFunction.call > (InterpretedFunction.java:140) > at org.mozilla.javascript.ScriptRuntime.evalSpecial > (ScriptRuntime.java:2217) > ... > > * Note: The last five stack trace lines keep repeating (hence the ...) > > Does anyone have any suggestions or explanations? Thanks. > |
From: Marc G. <mgu...@ya...> - 2005-07-15 15:50:30
|
Hi, for a few monthes, htmlunit worked on ebay with a small adaptation to cope with incorrect html (tags like <head3> found in <head>). Now the ebay's generated html seems to be correct but htmlunit fails executing the js. If you don't *really* have to, I would recommend to you not to investigate on it: ebay's javascript is probably the most awfull js code I've had to work on when making htmlunit work for it for some monthes. Marc. David D. Kilzer wrote: > It's probably a missing (or misimplemented) JavaScript feature in > Htmlunit. Have you tried using a different browser type by passing in > a constant to the WebClient constructor to make it look like a > different browser? The default is MSIE 6, I believe. Try the Mozilla > 1.0 browser to see if it behaves differently. For example, Google's > home page returns different JavaScript depending on the browser type. > > Htmlunit has a "sanity test" as part of its unit tests that hits the > home pages of a variety of external web sites. I would recommend > filing a bug on SourceForge about this since it seems to be another > good external web site to hit. > > Dave > > > On Jul 11, 2005, at 1:02 AM, John Smith wrote: > >> I don't have a specific question per se. However, I am concerned >> about HTMLUnit's behavior when I attempt to access ebay.com: >> >> Code >> ------------------ >> import java.net.URL; >> import com.gargoylesoftware.htmlunit.WebClient; >> import com.gargoylesoftware.htmlunit.html.HtmlPage; >> >> public class Test { >> >> public static void main( String[] args ) { >> >> try { >> >> WebClient webClient = new WebClient(); >> webClient.setRedirectEnabled( true ); >> >> HtmlPage page = ( HtmlPage ) webClient.getPage( new URL( >> "http://www.ebay.com" ) ); >> >> if ( page != null ) { >> >> System.out.println( page.asXml() ); >> } >> >> } catch ( Exception e ) { >> >> System.err.println( "Exception: " + e.getMessage() ); >> e.printStackTrace(); >> } >> } >> } >> >> Output >> ------------------ >> >>> java Test >>> >> Jul 11, 2005 1:51:59 AM >> com.gargoylesoftware.htmlunit.javascript.host.Document jsxSet_cookie >> INFO: Added cookie: ebay=%5Edv%3D42d208ff%5E >> Jul 11, 2005 1:52:00 AM >> com.gargoylesoftware.htmlunit.javascript.host.Document jsxSet_cookie >> INFO: Added cookie: ebay=%5Edv%3D42d20900%5E >> Jul 11, 2005 1:52:04 AM >> com.gargoylesoftware.htmlunit.javascript.host.Document jsxSet_cookie >> INFO: Added cookie: lucky9=626637 >> Exception in thread "main" java.lang.StackOverflowError >> at java.net.URLStreamHandler.parseURL(Unknown Source) >> at sun.net.www.protocol.file.Handler.parseURL(Unknown Source) >> at java.net.URL.<init>(Unknown Source) >> at java.net.URL.<init>(Unknown Source) >> at sun.misc.URLClassPath$FileLoader.getResource(Unknown Source) >> at sun.misc.URLClassPath$FileLoader.findResource(Unknown Source) >> at sun.misc.URLClassPath.findResource(Unknown Source) >> at java.net.URLClassLoader$2.run(Unknown Source) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.net.URLClassLoader.findResource(Unknown Source) >> at java.lang.ClassLoader.getResource(Unknown Source) >> at java.lang.ClassLoader.getResourceAsStream(Unknown Source) >> at java.util.ResourceBundle$1.run(Unknown Source) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.util.ResourceBundle.loadBundle(Unknown Source) >> at java.util.ResourceBundle.findBundle(Unknown Source) >> at java.util.ResourceBundle.getBundleImpl(Unknown Source) >> at java.util.ResourceBundle.getBundle(Unknown Source) >> at java.util.logging.Level.getLocalizedName(Unknown Source) >> at java.util.logging.SimpleFormatter.format(Unknown Source) >> at java.util.logging.StreamHandler.publish(Unknown Source) >> at java.util.logging.ConsoleHandler.publish(Unknown Source) >> at java.util.logging.Logger.log(Unknown Source) >> at java.util.logging.Logger.doLog(Unknown Source) >> at java.util.logging.Logger.logp(Unknown Source) >> at org.apache.commons.logging.impl.Jdk14Logger.log >> (Jdk14Logger.java:91) >> at org.apache.commons.logging.impl.Jdk14Logger.error >> (Jdk14Logger.java:119) >> at >> com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.runtimeEr >> ror(StrictErrorReporter.java:113) >> at org.mozilla.javascript.Context.reportRuntimeError >> (Context.java:1054) >> at org.mozilla.javascript.Parser.parse(Parser.java:354) >> at org.mozilla.javascript.Parser.parse(Parser.java:287) >> at org.mozilla.javascript.Context.compileImpl(Context.java: 2349) >> at org.mozilla.javascript.Context.compileString >> (Context.java:1372) >> at org.mozilla.javascript.ScriptRuntime.evalSpecial >> (ScriptRuntime.java:2202) >> at org.mozilla.javascript.ScriptRuntime.callSpecial >> (ScriptRuntime.java:2071) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2922) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2164) >> at org.mozilla.javascript.InterpretedFunction.call >> (InterpretedFunction.java:140) >> at org.mozilla.javascript.ScriptRuntime.evalSpecial >> (ScriptRuntime.java:2217) >> at org.mozilla.javascript.ScriptRuntime.callSpecial >> (ScriptRuntime.java:2071) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2922) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2164) >> at org.mozilla.javascript.InterpretedFunction.call >> (InterpretedFunction.java:140) >> at org.mozilla.javascript.ScriptRuntime.evalSpecial >> (ScriptRuntime.java:2217) >> at org.mozilla.javascript.ScriptRuntime.callSpecial >> (ScriptRuntime.java:2071) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2922) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2164) >> at org.mozilla.javascript.InterpretedFunction.call >> (InterpretedFunction.java:140) >> at org.mozilla.javascript.ScriptRuntime.evalSpecial >> (ScriptRuntime.java:2217) >> at org.mozilla.javascript.ScriptRuntime.callSpecial >> (ScriptRuntime.java:2071) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2922) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2164) >> at org.mozilla.javascript.InterpretedFunction.call >> (InterpretedFunction.java:140) >> at org.mozilla.javascript.ScriptRuntime.evalSpecial >> (ScriptRuntime.java:2217) >> at org.mozilla.javascript.ScriptRuntime.callSpecial >> (ScriptRuntime.java:2071) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2922) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2164) >> at org.mozilla.javascript.InterpretedFunction.call >> (InterpretedFunction.java:140) >> at org.mozilla.javascript.ScriptRuntime.evalSpecial >> (ScriptRuntime.java:2217) >> at org.mozilla.javascript.ScriptRuntime.callSpecial >> (ScriptRuntime.java:2071) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2922) >> at org.mozilla.javascript.Interpreter.interpret >> (Interpreter.java:2164) >> at org.mozilla.javascript.InterpretedFunction.call >> (InterpretedFunction.java:140) >> at org.mozilla.javascript.ScriptRuntime.evalSpecial >> (ScriptRuntime.java:2217) >> ... >> >> * Note: The last five stack trace lines keep repeating (hence the ...) >> >> Does anyone have any suggestions or explanations? Thanks. >> > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |