0

Problem

My selenium functional test is failing when I run using the Chrome driver, but works when using Firefox.

My Environment

  1. Mac OS X Mountain Lion
  2. Chrome Version 22.0.1229.94
  3. Build info: version: '2.2.1', revision: '16551', time: '2012-04-11 21:42:35'
  4. System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.2', java.version: '1.6.0_35' Driver info: driver.version: ChromeDriver

Steps to Reproduce

The exception occurs when using the Geb Grails example application from github.

Run the application using the Chrome driver:

grails -Dgeb.env=chrome test-app

The tests will begin to run, an instance of Chrome is successfully opened, but nothing happens afterwards. The Chrome browser isn't directed to a url, it just sits there with a silly grin on its face. The below error is thrown in the console after a 15 second (or so) timeout.

The Error

Caused by: org.openqa.selenium.WebDriverException: Unable to either launch or connect to Chrome. 
Please check that ChromeDriver is up-to-date. Using Chrome binary 
at: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome 

My Debugging Steps

  1. Per this stackoverflow post, I've attempted various different versions of the driver with no effect.
  2. The tests are successful when using the Firefox driver (sadly, I must test with Chrome).
  3. Attempt to use the latest beta of chrome Version 23.0.1271.40 beta. no luck.
  4. Upgraded the geb and selenium versions in the test app to latest and greatest: def gebVersion = "0.7.2" def seleniumVersion = "2.25.0"

Humble Thanks Section

Thanks for taking a look at this. I'd love to adopt geb, but its been an uphill battle to date.

Community
  • 1
  • 1
John Gordon
  • 2,181
  • 5
  • 28
  • 47

2 Answers2

2

Might be a silly answer but did you install the chrome driver? http://code.google.com/p/selenium/wiki/ChromeDriver

For Firefox, you don't need to install a driver but for Chrome and IE, you do. That may be why your tests are running using FF and not chrome.

Good luck!

ontk
  • 942
  • 1
  • 10
  • 24
  • 2
    Silly as it may be, you were right....tell your sister you were riiiight. Sweet jayzuss, I can't believe I missed that. A simple call to `brew install chromedriver` and all was well. I _did_ have a version of chromedriver installed, but I think it was an old, out of date one. Thanks for helping me out! – John Gordon Oct 24 '12 at 22:38
  • It was confusing to me as well at the beginning, that's why I thought of this possibility. Glad it solved your issue. – ontk Oct 24 '12 at 23:59
0

I am not sure that it is Geb related, I think you will get the similar behaviour when you run the tests using WebDriver Chrome Driver.

I have seen these kind of errors when Chrome is not on the path. chrome.binary should always be the absolute path to the actual executable. for mac, this usually look like: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

What version of Selenium/WebDriver you are using?

haroonzone
  • 374
  • 1
  • 4
  • Nice idea. I edited my path to include the Google Chrome directory: `type "Google Chrome" Google Chrome is /Applications/Google Chrome.app/Contents/MacOS/Google Chrome`, but without any change in the above behaviour. – John Gordon Oct 24 '12 at 22:16