Hello, friends I am again with you to share solution of a problem in functional testing using geb in grails. I have faced this problem while I am using chrome browser to run test. This shows an exception that you do not have any driver for chrome but I have already installed chrome in my Ubuntu system. Then I found a solution for this and I want to share it with you.

  • My GebConfig.groovy entry is like this:-
    import org.openqa.selenium.chrome.ChromeDriver
    
    driver = { 
        def driver = new ChromeDriver()
        driver.manage().window().maximize()
        return driver 
    }
    
    environments {
        chrome {
            driver = { def driver = new ChromeDriver()
                driver.manage().window().maximize()
                return driver
            }
        }
    }
    
  • When I run test this error occurs:-
    Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

To fix this problem follow the easy steps:-

  • Download the latest chrome driver from this link Download Chrome.
  • Extract the driver from downloaded file.
  • Move extracted driver from current directory to /bin directory of your system by using this command from console sudo mv chromedriver /bin
  • Now run your application test, it works…. 🙂

I hope this help you, please give your valuable feedback.