July 2019
Intermediate to advanced
536 pages
12h 57m
English
The following example shows how to use the varargs parameter in the setDriver method, which is called optPreferences. This is the setDriver method so far, from what we have built:
@SafeVarargspublic final void setDriver(String browser, String environment, String platform, Map<String, Object>... optPreferences) throws Exception { DesiredCapabilities caps = null; String localHub = "http://127.0.0.1:4723/wd/hub"; String getPlatform = null; switch (browser) { case "firefox": caps = DesiredCapabilities.firefox(); FirefoxProfile ffProfile = new FirefoxProfile(); ffProfile.setPreference("browser.autofocus", true); caps.setCapability(FirefoxDriver.PROFILE, ffProfile); caps.setCapability("marionette", true); System.setProperty("webdriver.gecko.driver" ...
Read now
Unlock full access