setting binary path for Portable Firefox and use it as default browser for tests

28 views
Skip to first unread message

GebUser

unread,
Oct 28, 2019, 3:20:48 PM10/28/19
to Geb User Mailing List
hi,

how do you set Portable Firefox as default browser for your Geb tests? I tried the following in GebConfig.groovy and it still picked up the default firefox binary location "C:\\Program Files\\Mozilla Firefox\\firefox.exe"

.


firefox {

FirefoxProfile profile = new FirefoxProfile();


FirefoxOptions options = new FirefoxOptions();
options.setCapability("javascriptEnabled", true);
options.setCapability("acceptInsecureCerts", true);
driver = {
def tmpDriver = new FirefoxDriver(new GeckoDriverService.Builder().usingFirefoxBinary(new FirefoxBinary(new File("C:\\Users\\rnatesan\\Downloads\\FirefoxPortable" +
"\\FirefoxPortable.exe"))).build(), options)
tmpDriver.manage().window().maximize()
return tmpDriver }





Thanks,
Ramesh

Ben Frey

unread,
Oct 28, 2019, 3:39:33 PM10/28/19
to Geb User Mailing List
Not sure if it'll work similarly for Firefox, but I for Chromedriver I put it inside my project and did this:
System.setProperty('webdriver.chrome.driver', 'src/test/resources/chromedriver')
driver
= { new ChromeDriver() }

Message has been deleted

GebUser

unread,
Oct 29, 2019, 1:47:13 PM10/29/19
to Geb User Mailing List
It worked fine after setting system property:

systemProperty 'webdriver.firefox.bin', "C:\\Users\\rnatesan\\PortableApps\\FirefoxPortable\\App\\Firefox64\\firefox.exe"


But it is not opening in maximized window mode even though I have it like this:

firefox {
  FirefoxOptions options = new FirefoxOptions();
options.setCapability("javascriptEnabled", true);
options.setCapability("acceptInsecureCerts", true);
  driver = { def tmpDriver = new FirefoxDriver(options)
tmpDriver.manage().window().maximize()
return tmpDriver }
}

Marcin Erdmann

unread,
Oct 30, 2019, 4:37:58 AM10/30/19
to geb-...@googlegroups.com
Are you sure you are running in the "firefox" geb environment? The easiest way to verify would be to simply throw an exception from the driver closure (e.g. driver = { throw new Exception("Yes, running in firefox environment") }), run again and see failures with the exception message.

--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/155d52fe-ba47-429a-a771-8f978675ae3a%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages