3

I am usign C#, with Gallio/mbUnit to write a very simple set of tests that open a browser, navigate to google.com, type 'seleniumhq' in the search box, and click the search button.

I create my host with:

java -jar \"C:\\selenium-server-standalone-2.15.0.jar\" -role hub -port 4444

and my node with:

java -jar \"C:\selenium-server-standalone-2.15.0.jar\" -role node -hub http://[hostIP]:4444/grid/register -port 5556 -browser browserName=htmlunit,platform=ANY,version=firefox,maxInstances=1

I create my webDriver instance, I use:

driver = new RemoteWebDriver("http://localhost:4444/wd/hub", DesiredCapabilities.HtmlUnitWithJavaScript());

I am monitoring my node machine and when the test commences, the CPU pegs to 99% with just 1 test running. I get timeouts when waiting for the search button to display... it's there, just not visible, even after 40 seconds:

var wait = new WebDriverWait(WebDriver, new TimeSpan(0, 0, 0, 40)); 
wait.Until(m => m.FindElement(By.Name("btnG")).Displayed);

Any thoughts on why that element isn't visible for HtmlUnit consistently?

Any thoughts on why the CPU pegs at or near 100% and spikes in memory up to 800,000K for HtmlUnit on a remote node?

I have the copied the same test to create 10 identical tests and if I remove the click search button code, the HtmlUnit tests take 65 seconds. This test is using two nodes, DegreeOfParallelism set at 10, and MaxInstances set at 5 for each node. When I run the same tests with the same paramters with Chrome, they run in 35 seconds and I don't see the CPU going crazy. Anybody have any ideas on this? HtmlUnit is supposed to be about 4x's as fast from what I have read. I am guessing that I have something wrong that should be fairly obvious.

Thanks for all help and suggestions.

Oleg Dok
  • 21,109
  • 4
  • 45
  • 54
Jesse Sanders
  • 511
  • 6
  • 13

1 Answers1

0

A bit late, but:

To find out what the HtmlUnitDriver is doing, get a thread dump using jstack <pid>. You'll probably see that it is deadlocked or stuck in a loop.

I've have had some deadlock & hanging issues using older HtmlUnit versions, but the latest Selenium server versions (2.31.0) are using HtmlUnit 2.11 which seems to have resolved these issues.

It looks like you were using Selenium 2.15 which includes HtmlUnit 2.9, which could be the problem.

Barry Pitman
  • 3,087
  • 1
  • 24
  • 32