Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS is not displayed in Selenium WebDriver

I have a really strange error. I wrote a JSF-webpage. The page functions as expected if I test it manually in Firefox. But, if I try to test the site with Selenium(FireFoxDriver), the site looses its CSS-files after first clicking on a link. If I refresh the site and the cache with Cmd+F5, the CSS-files appear again in this Firefox window. I have no clue, where the problem comes from. Has anybody already been confronted with this problem or any ideas?

like image 623
Janus Avatar asked Jun 14 '13 16:06

Janus


1 Answers

Had the same problem, fixed it this way.

public static void initialise(){
    FirefoxProfile newProfile = new FirefoxProfile();
    newProfile.setPreference("browser.cache.disk.enable", false);
    Instance = new FirefoxDriver(newProfile);           
}
like image 163
user2935935 Avatar answered Sep 28 '22 06:09

user2935935