From: Rural H. <rur...@gm...> - 2016-08-25 09:02:48
|
Hi Ronald, We do need a similar solution. We usually supply a overridden pre-processor to WebClient and do things like this in the pre-processor: @Override public String preProcess(HtmlPage hp, String sourceCode, String sourceName, int lineNumber, HtmlElement he) { //qq zone temp fix if(sourceName.indexOf("/qzone/")>0&&sourceCode.indexOf("if( QZFL.userAgent.ie)")>0) { //System.out.println("Found ua code at "+sourceName+"#"+lineNumber); return sourceCode.replace("if(QZFL.userAgent.ie)", "if(false)"); } **/ return sourceCode; } Sometimes it's not a bug and sometimes it's not practicable to wait for a fix. 2016-08-25 14:07 GMT+08:00 Ronald Brill <rb...@rb...>: > >We usually use this to diagnose js errors and filter/replace problematic > js if we can not fix it. > > But this was not done by the original ScriptPreProcessor? How have you > done this. > Do you need a similar solution? > > Regarding problematic js - if HtmlUnit differs from real browsers this is > a bug. Please report all this situations and we will try (sooner or later > ;-) to fix this. > > RBRi > > On Thu, 25 Aug 2016 10:00:14 +0800 Rural Hunter wrote: > > > >Hi Ronald, > > > >We don't use a customized version. We were using 2.14 and I just try to > >upgraded to 2.23. We usually use this to diagnose js errors and > >filter/replace problematic js if we can not fix it. > > > >2016-08-24 23:20 GMT+08:00 Ronald Brill <rb...@rb...>: > > > >> On Wed, 24 Aug 2016 11:01:48 +0800 Rural Hunter wrote: > >> > > >> >I just tried to upgrade my htmlunit dependency from 2.14 to 2.23 and > found > >> >the ScriptPreProcessor is removed. I searched the javadoc and change > >> >history but didn't find anything about the function deprecation. Why > is it > >> >removed and anything else I can use to replace it? > >> > > >> > >> ScriptPreProcessor was removed as part of the removal of IE8 support. > >> Do you have a customized version in use and if yes what problem do you > >> solve with this? > >> > >> RBRI > >> > > > > > > |