Implementing Firefox profile in Selenium Webdriver with Java
While automating a web application, we want the application to be opened in a customized browser. A browser without any theme/extension/addons or with customized settings; settings like pop-ups are allowed, certain sites are certified etc. The reason why we want a different browser profile is our regular use browser has several addons installed, several bookmarks, and some browser level restrictions which might hamper the proper functioning of the AUT.
Firefox provides a good mechanism to manage different profiles of browser in the same machine. http://goo.gl/NTklV is a link which shows how to create a profile in Firefox. While creating a profile, we can customized the browser settings per our project need.
This tip is about how to implement a profile in Selenium Web driver using Java. This implementation is of course after manually creation of the profile. The below code snippet demonstrates the implementation of profile in Web driver:
ProfilesIni allProfiles = new ProfilesIni(); //Declare an object of ProfilesIni class
FirefoxProfile fProfile = allProfiles.getProfile(“Profile Name”); //Get the specific Firefox profile information. “Profile Name” here is the name given to the profile while creating it.
FirefoxDriver wbdv = new FirefoxDriver(fProfile); //Pass the profile information to FirefoxDriver.
When a browser will be opened using “wbdv” object, it’ll be opened with the specified profile.
Written By: Priyanka Agrawal, QA Engineer, Mindfire Solutions
Posted on July 17, 2013, in Automation Testing, Selenium Testing and tagged AUT, Firefox, Firefox Profile, Mindfire Solutions, Priyanka Agrawal, Selenium, Selenium Java, Selenium WebDriver, WebDriver. Bookmark the permalink. Leave a comment.
Leave a comment
Comments 0