Reputation: 14711
this is my current code:
FirefoxBinary ffox = new FirefoxBinary(firefoxPath);
ffox.setEnvironmentProperty("DISPLAY", ":20");
driver = new FirefoxDriver(ffox, null);
but I also need to add this to DRIVER:
DesiredCapabilities dc=new DesiredCapabilities();
dc.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR,UnexpectedAlertBehaviour.ACCEPT);
driver =new FirefoxDriver(dc);
In the first piece of code, DRIVER is already taking 2 parameters, how can I add this one as well?
Upvotes: 2
Views: 3889
Reputation: 25056
FirefoxBinary ffox = new FirefoxBinary(firefoxPath);
ffox.setEnvironmentProperty("DISPLAY", ":20");
driver = new FirefoxDriver(ffox, null);
Your current code is creating an instance of FirefoxBinary
, setting some properties inside it, and then passing it, along with null
, into the FirefoxDriver
constructor.
This matches the FirefoxBinary
, FirefoxProfile
constructor.
There is another constructor to allow you to pass in a set of DesiredCapabilites
too, along with what you've currently got:
FirefoxBinary ffox = new FirefoxBinary(firefoxPath);
ffox.setEnvironmentProperty("DISPLAY", ":20");
DesiredCapabilities dc =new DesiredCapabilities();
dc.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR,UnexpectedAlertBehaviour.ACCEPT);
driver = new FirefoxDriver(ffox, null, dc);
(Untested code).
Upvotes: 2