Source:
<code>private static EventFiringWebDriver getFFInstance() { if ("WINDOWS 8".equals(System.getProperty("os.name").toUpperCase())) { System.setProperty( "webdriver.firefox.bin", "c:" + File.separator + "Program Files (x86)" + File.separator + "Mozilla Firefox" + File.separator + "Firefox.exe" ); } if ("LINUX".equals(System.getProperty("os.name").toUpperCase())) { File homePath = new File(System.getenv("HOME") + File.separator); File mozillaPath = new File(homePath + File.separator + ".mozilla"); File tmpFile; if (mozillaPath.exists()) { try { tmpFile = File.createTempFile("webdriver", null, mozillaPath); } catch (IOException ex) { throw new RuntimeException( "Can't create file in path: %s".replace("%s", mozillaPath.getAbsolutePath())); } } else { try { tmpFile = File.createTempFile("webdriver", null, homePath); } catch (IOException ex) { throw new RuntimeException( "Can't create file in path: %s".replace("%s", homePath.getAbsolutePath())); } } tmpFile.delete(); } if (browserName.contains("CONSOLE")) { try { File jsErr = new File( "." + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "Firebug" + File.separator + "JSErrorCollector.xpi" ); firefoxProfile.addExtension(jsErr); Global.JS_ERROR_ENABLED = true; } catch (FileNotFoundException e) { System.out.println("JS extension file doesn't exist in provided location"); } catch (IOException e) { System.out.println("Error with adding firefox extension"); } } if (unstablePageLoadStrategy) { firefoxProfile.setPreference("webdriver.load.strategy", "unstable"); } if (StringUtils.isNotBlank(ConfigurationFactory.getConfig().getDisableFlash().toString())) { firefoxProfile.setPreference("plugin.state.flash", 0); <START> } <END> caps.setCapability(FirefoxDriver.PROFILE, firefoxProfile); setBrowserLogging(Level.SEVERE); return new EventFiringWebDriver(new FirefoxDriver(caps)); }</code><technical_language>toString() is needed</technical_language>

Target:
private static EventFiringWebDriver getFFInstance() { if ("WINDOWS 8".equals(System.getProperty("os.name").toUpperCase())) { System.setProperty( "webdriver.firefox.bin", "c:" + File.separator + "Program Files (x86)" + File.separator + "Mozilla Firefox" + File.separator + "Firefox.exe" ); } if ("LINUX".equals(System.getProperty("os.name").toUpperCase())) { File homePath = new File(System.getenv("HOME") + File.separator); File mozillaPath = new File(homePath + File.separator + ".mozilla"); File tmpFile; if (mozillaPath.exists()) { try { tmpFile = File.createTempFile("webdriver", null, mozillaPath); } catch (IOException ex) { throw new RuntimeException( "Can't create file in path: %s".replace("%s", mozillaPath.getAbsolutePath())); } } else { try { tmpFile = File.createTempFile("webdriver", null, homePath); } catch (IOException ex) { throw new RuntimeException( "Can't create file in path: %s".replace("%s", homePath.getAbsolutePath())); } } tmpFile.delete(); } if (browserName.contains("CONSOLE")) { try { File jsErr = new File( "." + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "Firebug" + File.separator + "JSErrorCollector.xpi" ); firefoxProfile.addExtension(jsErr); Global.JS_ERROR_ENABLED = true; } catch (FileNotFoundException e) { System.out.println("JS extension file doesn't exist in provided location"); } catch (IOException e) { System.out.println("Error with adding firefox extension"); } } if (unstablePageLoadStrategy) { firefoxProfile.setPreference("webdriver.load.strategy", "unstable"); } if (StringUtils.isNotBlank(ConfigurationFactory.getConfig().getDisableFlash())) { firefoxProfile.setPreference("plugin.state.flash", 0); } caps.setCapability(FirefoxDriver.PROFILE, firefoxProfile); setBrowserLogging(Level.SEVERE); return new EventFiringWebDriver(new FirefoxDriver(caps)); }