-1

I have this code:

driver = new HtmlUnitDriver();
        ((HtmlUnitDriver) driver).setJavascriptEnabled(true);

        baseUrl = "http://www.url.com/";

        driver.get(baseUrl + "/");
            ...

But if i try to Run i have this exception:

com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot call method "match" of undefined (http://www.url.com//javascript/jquery.ceebox/jquery.swfobject.js#2)

How i can solve it? there is a way?

FelasDroid
  • 623
  • 3
  • 10
  • 26

1 Answers1

0

The javascript support is not upto the mark and if you just wan't to suppress these errors, you can use :

webClient.getOptions().setThrowExceptionOnScriptError(false);

My generic webclient configuration looks like below, in almost all of my projects :

WebClient client = new WebClient(BrowserVersion.FIREFOX_17);
        client.getOptions().setThrowExceptionOnFailingStatusCode(false);
        client.getOptions().setCssEnabled(false);
        client.getOptions().setThrowExceptionOnScriptError(false);
        client.getOptions().setPrintContentOnFailingStatusCode(false);
coding_idiot
  • 13,526
  • 10
  • 65
  • 116