Ashish Joseph
Ashish Joseph

Reputation: 1153

Grails - functional test with Geb doesnt work with HtmlUnitDriver

I have created a functional test, which works fine when driver is FireFox or Chrome. The same fails when i try to use HtmlUnit driver. The application gets started, but gets stuck while running the first test. Then i have kill the java process to stop it.

Pasting the code snippet that i use to initialize the htmlunit driver

driver = {
  def driver = new HtmlUnitDriver()
  driver.javascriptEnabled = true
  baseUrl = 'http://localhost:8585'
  driver  }

Upvotes: 1

Views: 581

Answers (1)

Calahad
Calahad

Reputation: 1488

Which version of grails are you using? HTMLUnit is broken with grails 2.2 onwards.

We've had lots of pains with it, and ditched it for phantomJS which works beautifully, we only had to make some minor tweaks to some tests.

Tomás Lin has a great post on how to configure phantomJS for Geb, as well as many other web drivers:

http://fbflex.wordpress.com/2013/03/18/how-to-configure-webdriver-in-grails-for-your-geb-tests/

edit: you may have to add the path to the phantomJS binary:

System.setProperty('phantomjs.binary.path', phantomJs.absolutePath)

Upvotes: 1

Related Questions