0

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?

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
user1373231
  • 55
  • 1
  • 8

1 Answers1

0

Thanks for reporting.

This has been fixed in 2.25-SNAPSHOT by this commit.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56