Wednesday, May 27, 2015

Took me a while to solve this one. When running automated test cases in Selenium, FireFox runs super slow.

If FireFox (38) is running slow, it could be because of hardware acceleration. Turing it off in the profiles helps for the current user but the Selenium remote driver starts FireFox using a special profile that isn't listed in the FireFox profile editor. In order to turn off hardware acceleration every time the browser launches, you need to do something like this;

DesiredCapabilities capabilities = DesiredCapabilities.Firefox();
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("layers.acceleration.disabled", true);
capabilities.SetCapability(FirefoxDriver.ProfileCapabilityName, profile.ToBase64String());
IWebDriver webDriver = new RemoteWebDriver(new Uri("http://localhost:4445/wd/hub"), capabilities);

Hope this helps.

Assuming latest versions of everything and running on Window.

No comments: