Hi Shane,
The user group (
https://groups.google.com/d/forum/geb-user) would probably be a better forum for this question as this is a list for discussions about development of Geb itself. I think we can live with this question here but please keep that in mind for the future.
In general you would need to create a custom implementation of BrowserStackDriverFactory which overrides configureCapabilities(DesiredCapabilities) and use that in your GebConfig.groovy instead of the one Geb ships with. It would look like the following if you were to do it for Firefox as an example:
class CustomUserAgentBrowserStackDriverFactory extends BrowserStackDriverFactory {
protected void configureCapabilities(DesiredCapabilities desiredCapabilities) {
super.configureCapabilities(desiredCapabilities)
if (desiredCapabilities.getCapability("browserName") == "firefox") {
def profile = new FirefoxProfile()
profile.setPreference("general.useragent.override", "whatever you want")
desiredCapabilities.setCapability(FirefoxDriver.PROFILE, profile)
}
}
}
So basically you would be using the fact that overriding configureCapabilities(DesiredCapabilities) allows you to modify the DesiredCapabilities before a browser is provisioned for you by BrowserStack. You might find the following link useful as well as it explains how to configure ChromeOptions which are aparently used to set user agent in chrome:
https://www.browserstack.com/automate/java#chrome-options.
Please let me know if you need more help with that.
Cheers,
Marcin