Re: Class Cast Exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Class Cast Exception

asashour
Hi,

- You must subscribe to the list before posting.
- This is now fixed in SVN.

Thanks,
Ahmed



----- Forwarded Message -----
From: "[hidden email]" <[hidden email]>
Sent: Wednesday, February 15, 2017 3:10 PM
Subject: Auto-discard notification

----- Forwarded Message -----

The attached message has been automatically discarded.
When I am loading a webpage in selenium html driver, there is Javascript execution error, but there is also this in the error logs java.lang.ClassCastException: com.gargoylesoftware.htmlunit.javascript.host.Window cannot be cast to com.gargoylesoftware.htmlunit.javascript.host.Console at com.gargoylesoftware.htmlunit.javascript.host.Console.error(Console.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
I have checked error method in the Console class
/**
 * This method performs logging to the console at "error" level.
 * @param cx the JavaScript context
 * @param thisObj the scriptable
 * @param args the arguments passed into the method
 * @param funObj the function
 */
@JsxFunction
public static void error(final Context cx, final Scriptable thisObj,
    final Object[] args, final Function funObj) {
    final WebConsole webConsole = ((Console) thisObj).getWebConsole();
    final Formatter oldFormatter = webConsole.getFormatter();
    webConsole.setFormatter(FORMATTER_);
    webConsole.error(args);
    webConsole.setFormatter(oldFormatter);
}
All Scriptable objects are not subclasses of console, so why is this here ?



When I am loading a webpage in selenium html driver, there is Javascript execution error, but there is also this in the error logs java.lang.ClassCastException: com.gargoylesoftware.htmlunit.javascript.host.Window cannot be cast to com.gargoylesoftware.htmlunit.javascript.host.Console at com.gargoylesoftware.htmlunit.javascript.host.Console.error(Console.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

I have checked error method in the Console class

/**
 * This method performs logging to the console at "error" level.
 * @param cx the JavaScript context
 * @param thisObj the scriptable
 * @param args the arguments passed into the method
 * @param funObj the function
 */
@JsxFunction
public static void error(final Context cx, final Scriptable thisObj,
    final Object[] args, final Function funObj) {
    final WebConsole webConsole = ((Console) thisObj).getWebConsole();
    final Formatter oldFormatter = webConsole.getFormatter();
    webConsole.setFormatter(FORMATTER_);
    webConsole.error(args);
    webConsole.setFormatter(oldFormatter);
}

All Scriptable objects are not subclasses of console, so why is this here ?


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user