Issue 1419 in selenium: HtmlUnitDriver is broken in 2.0b2

38 views
Skip to first unread message

sele...@googlecode.com

unread,
Mar 17, 2011, 8:24:01 PM3/17/11
to selenium-deve...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 1419 by baran...@gmail.com: HtmlUnitDriver is broken in 2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

What steps will reproduce the problem?

public static void main(String[] args) {
WebDriver wd = new HtmlUnitDriver(true);
Selenium selenium = new
WebDriverBackedSelenium(wd, "http://php-addressbook.sourceforge.net/");
selenium.open("http://php-addressbook.sourceforge.net/demo/");
selenium.type("user", "demo");
selenium.type("pass", "demo");
selenium.submit("LoginForm");
selenium.waitForPageToLoad("30000");
}

What is the expected output? What do you see instead?

Selenium crashes with the following stacktrace:

18.03.2011 2:07:42
com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument
jsxFunction_getElementById
WARNING: getElementById(user) did a getElementByName for Internet Explorer
Exception in thread "main" ======= EXCEPTION START ========
Exception
class=[net.sourceforge.htmlunit.corejs.javascript.JavaScriptException]
com.gargoylesoftware.htmlunit.ScriptException: [object Object] (injected
script#27)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)
at
net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
at
net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
at
org.openqa.selenium.htmlunit.HtmlUnitDriver.executeScript(HtmlUnitDriver.java:439)
at
org.openqa.selenium.internal.seleniumemulation.ElementFinder.findElement(ElementFinder.java:75)
at
org.openqa.selenium.internal.seleniumemulation.Type.handleSeleneseCommand(Type.java:47)
at
org.openqa.selenium.internal.seleniumemulation.Type.handleSeleneseCommand(Type.java:1)
at
org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:35)
at org.openqa.selenium.internal.seleniumemulation.Timer.run(Timer.java:61)
at
org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:274)
at
org.openqa.selenium.WebDriverCommandProcessor.doCommand(WebDriverCommandProcessor.java:204)
at com.thoughtworks.selenium.DefaultSelenium.type(DefaultSelenium.java:291)
at com.example.tests.Experiment.main(Experiment.java:15)
Caused by: net.sourceforge.htmlunit.corejs.javascript.JavaScriptException:
[object Object] (injected script#27)
at
net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1062)
at
net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
at
net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at
net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
at
com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
at
net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:559)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:524)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
... 14 more
JavaScriptException value = [object Object]
== CALLING JAVASCRIPT ==
[... lots of javascript code skipped ...]

What version of the product are you using? On what operating system?

Selenium 2.0b2, Windows 7

Please provide any additional information below.


sele...@googlecode.com

unread,
Mar 22, 2011, 7:11:03 AM3/22/11
to selenium-deve...@googlegroups.com
Updates:
Labels: Lang-Java Browser-HtmlUnit

Comment #1 on issue 1419 by theautomatedtester: HtmlUnitDriver is broken in
2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

have you tried a test with normal htmlunit and not using the
webdriverbackedselenium object?

sele...@googlecode.com

unread,
Mar 22, 2011, 7:43:14 AM3/22/11
to selenium-deve...@googlegroups.com

Comment #2 on issue 1419 by baran...@gmail.com: HtmlUnitDriver is broken in
2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

No, I haven't, but I see that selenium-2.0b2 uses exactly the same version
htmlunit-2.8.jar as did selenium-2.0b1. And 2.0b1 does work without errors.

sele...@googlecode.com

unread,
Apr 7, 2011, 4:42:16 PM4/7/11
to selenium-deve...@googlegroups.com

Comment #3 on issue 1419 by jcki...@gmail.com: HtmlUnitDriver is broken in
2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

I'm having the same issue. Any updates?

sele...@googlecode.com

unread,
May 10, 2011, 2:22:51 PM5/10/11
to selenium-deve...@googlegroups.com

Comment #4 on issue 1419 by francois...@gmail.com: HtmlUnitDriver is broken
in 2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

Same problem with 2.0b3

sele...@googlecode.com

unread,
May 28, 2011, 8:35:58 AM5/28/11
to selenium-deve...@googlegroups.com

Comment #5 on issue 1419 by sdarsha...@gmail.com: HtmlUnitDriver is broken
in 2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

For selenium 2.0b1 with driver as HtmlUnit and OS: win xp

I see the following warnings.

May 28, 2011 6:00:21 PM
com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: null [3:46] Error in style rule. Invalid token ":". Was
expecting one of: <S>, "}", <COMMA>, ";", "/", <PLUS>, "-", <HASH>,
<STRING>, <URI>, "!", "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>,
<LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>,
<ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>,
<DIMENSION>, <PERCENTAGE>, <NUMBER>, <FUNCTION>, <IDENT>.
May 28, 2011 6:00:21 PM
com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warning
WARNING: CSS warning: null [3:46] Ignoring the following declarations in
this rule.
May 28, 2011 6:00:21 PM
com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: null [6:21] Error in style rule. Invalid token ":". Was
expecting one of: <S>, "}", <COMMA>, ";", "/", <PLUS>, "-", <HASH>,
<STRING>, <URI>, "!", "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>,
<LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>,
<ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>,
<DIMENSION>, <PERCENTAGE>, <NUMBER>, <FUNCTION>, <IDENT>.
May 28, 2011 6:00:21 PM
com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warning
WARNING: CSS warning: null [6:21] Ignoring the following declarations in
this rule.
May 28, 2011 6:00:21 PM
com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: null [23:94] Error in declaration. Invalid token "=".
Was expecting one of: <S>, ":".
May 28, 2011 6:00:21 PM
com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: null [24:99] Error in declaration. Invalid token "=".
Was expecting one of: <S>, ":".

sele...@googlecode.com

unread,
Jun 12, 2011, 3:52:05 PM6/12/11
to selenium-deve...@googlegroups.com
Updates:
Status: WorkingAsIntended

Comment #6 on issue 1419 by simon.m.stewart: HtmlUnitDriver is broken in
2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

This is a function of the htmlunit driver being used in the remote server
having JS enabled. Try disabling javascript in the DesiredCapabilities sent
to the server.

sele...@googlecode.com

unread,
Jun 13, 2011, 5:30:31 AM6/13/11
to selenium-deve...@googlegroups.com

Comment #7 on issue 1419 by baran...@gmail.com: HtmlUnitDriver is broken in
2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

Simon,
1) it is __not__ a remote driver,
2) 'true' in HtmlUnitDriver constructor means __enabling__ JS.

sele...@googlecode.com

unread,
Jun 13, 2011, 8:47:35 AM6/13/11
to selenium-deve...@googlegroups.com

Comment #8 on issue 1419 by simonste...@google.com: HtmlUnitDriver is

Apologies. A closer look at the problem indicates:

1) You're using htmlunit with the selenium-backed webdriver: that's never
been properly supported because....
2) It looks like you've hit a bug in htmlunit.

sele...@googlecode.com

unread,
Oct 25, 2011, 10:25:18 AM10/25/11
to selenium-deve...@googlegroups.com

Comment #9 on issue 1419 by pedol.da...@gmail.com: HtmlUnitDriver is broken
in 2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

may I ask if anything is being done about this? the status of the ticket
still is WorkingAsIntended, even though it was stated in the last comment
that it's a bug. Or is this not concerning selenium and is looked at by the
htmlunit folks? If so, does anyone have a link. googling the error messages
produces very few results.

Thanks in advance

sele...@googlecode.com

unread,
Oct 25, 2011, 4:12:26 PM10/25/11
to selenium-deve...@googlegroups.com

Comment #10 on issue 1419 by simon.m.stewart: HtmlUnitDriver is broken in
2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

This is caused by an issue in htmlunit, and not in selenium.

sele...@googlecode.com

unread,
Nov 3, 2011, 12:26:37 PM11/3/11
to selenium-deve...@googlegroups.com

Comment #11 on issue 1419 by Sandra.M...@gmail.com: HtmlUnitDriver is

Hi,
do you have a solution for this?

sele...@googlecode.com

unread,
Nov 8, 2011, 12:47:23 PM11/8/11
to selenium-deve...@googlegroups.com

Comment #12 on issue 1419 by barancev: HtmlUnitDriver is broken in 2.0b2
http://code.google.com/p/selenium/issues/detail?id=1419

No, sorry, no solution.

HtmlUnitDriver is a poison for WebDriverBackedSelenium, they don't want to
work together.

Reply all
Reply to author
Forward
0 new messages