From: Ahmed A. <asa...@ya...> - 2014-03-06 08:55:47
|
Hi Sreenath, Previously, it was hinted to use one of the supported browsers, but you are using iPhone user-agent. You need to isolate minimal case (not with public website) that works with IE/FF/Chrome, otherwise you are on your own. Ahmed ________________________________ From: Sreenath <sre...@gm...> To: "htm...@li..." <htm...@li...> Sent: Thursday, March 6, 2014 11:42 AM Subject: Re: [Htmlunit-user] HtmlUnit support on Handlebars.template Hello Ronald Brill, Let provide minimal test case here, same works fine in real browser. import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.BrowserVersionFeatures; import com.gargoylesoftware.htmlunit.CookieManager; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.IncorrectnessListener; import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit.SilentCssErrorHandler; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class TestProgramJSIssue { public static void main(String args[]) throws FailingHttpStatusCodeException, IOException, InterruptedException { String url = "http://www.victoriassecret.com/victorias-secret-sport/all-tops/funnel-neck-pullover-vs-sport?ProductID=147289&CatalogueType=OLS"; CookieManager cm = new CookieManager(); cm.setCookiesEnabled(true); cm.clearCookies(); String UA = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5"; BrowserVersion bv = BrowserVersion.FIREFOX_17;; bv.setUserAgent(UA); bv.setOnLine(true); WebClient webClient = new WebClient(bv); cm.clearCookies(); cm.setCookiesEnabled(true); webClient.setCookieManager(cm); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); webClient.setJavaScriptTimeout(15000); webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.waitForBackgroundJavaScript(15000); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setRedirectEnabled(true); webClient.getOptions().setUseInsecureSSL(true); webClient.getOptions().setCssEnabled(true); //webClient.setRefreshHandler(new WaitingRefreshHandler(3000)); final IncorrectnessListener il = new MyIncorrectnessListener(); // it just quiets errors down webClient.setIncorrectnessListener(il); final SilentCssErrorHandler eh = new SilentCssErrorHandler(); webClient.setCssErrorHandler(eh); webClient.getOptions().setPopupBlockerEnabled(true); webClient.getCache().clear(); webClient.getCookieManager().clearCookies(); WebRequest request = new WebRequest(new URL(url)); HtmlPage page = webClient.getPage(request); Thread.sleep(8000); } } Getting following error in console with HtmlUnit. com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot call method "template" of undefined (http://dm.victoriassecret.com/resources/build/6794ee2b8a33fa2f29b16a44d6fd83a2e2027dc2/mobile/script/product.js#2) Please advice. On Thu, Mar 6, 2014 at 12:46 AM, Ronald Brill <rb...@rb...> wrote: Hi Sreenadh, > >short answer: Yes. > >Longer one; i guess you have to try and if you find situations, where HtmlUnit acts different than the real browser report an error. >And please keep in mind that the time for getting an error fixed mainly depends on the details of your error report (see: http://htmlunit.sourceforge.net/submittingJSBugs.html). >If you can show the error with a really simple test case (no js lib only some plain js statements), there is a good chance to get a fix. > > RBRi > > > >On Wed, 5 Mar 2014 23:39:29 +0530 Sreenath wrote: >> >>Does HtmlUnit support Handlebars.template js library? >> >>Came across failures on page loading on handlebars initialization. >> >>Please advice. >> >>Thanks >>Sreenadh >> > > >------------------------------------------------------------------------------ >Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. >With Perforce, you get hassle-free workflows. Merge that actually works. >Faster operations. Version large binaries. Built-in WAN optimization and the >freedom to use Git, Perforce or both. Make the move to Perforce. >http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk >_______________________________________________ >Htmlunit-user mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/htmlunit-user > -- If you judge people, you have no time to love them. ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |