public static WebDriver getFirefoxDriverWithJSSettings ( final String userAgent , final boolean javascriptEnabled ) { FirefoxProfile profile = new FirefoxProfile ( ) ; profile . setPreference ( "general.useragent.override" , userAgent ) ; profile . setPreference ( "javascript.enabled" , javascriptEnabled ) ; WebDriver driver = new FirefoxDriver ( profile ) ; return driver ; }
Gets a profile with a specific user agent with or without javascript enabled .