How do I set the user agent property for HtmlUnitDriver in Selenium Java ?
I can set it for the firefox driver with
FirefoxProfile ffp = new FirefoxProfile();
ffp.setPreference("general.useragent.override", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7");
WebDriver driver = new FirefoxDriver(ffp);
Is there a way to do this for HtmlUnitDriver ?
I’ve tried to use the setCapability(“UserAgentName”, “some UA settings”); but this does not work.
Did you try using DesiredCapabilities?