2 Replies Latest reply on Aug 5, 2014 5:44 AM by yan.langlois

    Configure HtmlUnitDriver

    yan.langlois

      Hello,

       

      I am using arquillian (version 1.1.5.Final) with graphene-webdriver (version 2.0.3.Final) and selenium-htmlunit-driver (version 2.42.0) to test a Richfaces (version 4.3.7.Final) application.

       

      When the page is loading, I get this error :

      EcmaError: lineNumber=[6831] column=[0] lineSource=[<no source>] name=[TypeError] sourceName=[https://xxx.xxx.xxx.xxx/myApplication/javax.faces.resource/jquery.js.jsf] message=[TypeError: Impossible de trouver la fonction getPropertyValue dans lobjet {1}. (https://xxx.xxx.xxx.xxx/myApplication/javax.faces.resource/jquery.js.jsf#6831)]

      com.gargoylesoftware.htmlunit.ScriptException: TypeError: Impossible de trouver la fonction getPropertyValue dans lobjet {1}. (https://xxx.xxx.xxx.xxx/myApplication/javax.faces.resource/jquery.js.jsf#6831)

       

      When I use directly HTMLUnit, I need to add this line to avoid the same error :

      final WebClient webClient = new WebClient(BrowserVersion.CHROME);

      webClient.getOptions().setThrowExceptionOnScriptError(false);


      Is it possible to configure HTMLUnitWebDriver from drone extension to set the property ThrowExceptionOnScriptError to false ?


      Thank you for your help.

        • 1. Re: Configure HtmlUnitDriver
          kpiwko

          Hello Yan,

           

          this is currently not possible, as Selenium does not allow access to WebClientOptions without subclassing HtmlUnitDriver. I've filled [ARQ-1836] Support HtmlUnitDriver client options - JBoss Issue Tracker with more details, Drone could in theory bridge the gap.

           

          Have you though of using phantomjs instead if you need to test headless?

           

          Thanks,

           

          Karel

          1 of 1 people found this helpful
          • 2. Re: Configure HtmlUnitDriver
            yan.langlois

            Thank you for your JIRA issue, I think it will be very usefull.

             

            For your information, I cannot use PhantomJS because I work on a project where the login page is redirected via a HTTP 302 redirect. PhantomsJS does not seem to follow this kind of redirection. Nevertheless, I found a workarround with this property of HTMLUnitDriver :

             

             

            It seems that firefox browser version within HTMLUnit copes better with JavaScript.

             

            With RichFaces, I also needed to change the default CSS parser. RF depend on net.sourceforge.cssparser:cssparser:0.9.5. I use version 0.9.14. My pom looks like that :