Reputation: 11307
This seems to work:
@Grapes([
@Grab("org.codehaus.geb:geb-core:0.7.2"),
@Grab("org.seleniumhq.selenium:selenium-htmlunit-driver:2.25.0"),
@Grab("org.seleniumhq.selenium:selenium-support:2.25.0"),
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.25.0")
])
import geb.Browser
import org.openqa.selenium.firefox.FirefoxDriver
Browser.drive() {
go "http://www.google.com"
}
But how do I use FirefoxDriver
instead of HtmlUnitDriver
? This just starts Firefox but all the drive
instructions are executed in HtmlUnitDriver
...
@Grapes([
@Grab("org.codehaus.geb:geb-core:0.7.2"),
@Grab("org.seleniumhq.selenium:selenium-htmlunit-driver:2.25.0"),
@Grab("org.seleniumhq.selenium:selenium-support:2.25.0"),
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.25.0")
])
import geb.Browser
import org.openqa.selenium.firefox.FirefoxDriver
def browser = new Browser(driver: new FirefoxDriver())
browser.drive {
go "http://www.google.com"
}
Upvotes: 1
Views: 4093
Reputation: 4759
We have done following configuration in the GebConfig.groovy to register FireFoxDriver with Geb.
driver = {
def firefoxDriver = new FirefoxDriver()
SharedResources.instance.browser = firefoxDriver
firefoxDriver.manage().window().maximize()
firefoxDriver
}
Hope that helps
Upvotes: 1
Reputation: 7134
Use a configuration script as outlined here: http://www.gebish.org/manual/0.7.0/configuration.html
Upvotes: 2