{"id":16361,"date":"2014-12-12T20:35:33","date_gmt":"2014-12-12T15:05:33","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=16361"},"modified":"2014-12-12T21:28:42","modified_gmt":"2014-12-12T15:58:42","slug":"customizing-the-firefox-profile-and-using-with-selenium-web-driver","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/customizing-the-firefox-profile-and-using-with-selenium-web-driver\/","title":{"rendered":"Customizing the Firefox Profile and using with Selenium Web Driver"},"content":{"rendered":"<p><strong>What is Firefox Profile<\/strong><\/p>\n<p>Firefox saves your browser information such as <strong>Bookmarks, Downloads and Browsing History,<\/strong> <strong>etc <\/strong>in a set of files called <strong>profile<\/strong>, which is stored in a specified location by Firefox in user file directory.<\/p>\n<p>You can have multiple Firefox profiles, each containing a separate set of user information. The\u00a0<strong>Profile Manager <\/strong>allows you to\u00a0<strong>create<\/strong>,\u00a0<strong>remove<\/strong>,\u00a0<strong>rename<\/strong>, and\u00a0<strong>switch<\/strong>\u00a0profiles.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Why I need a New Profile<\/strong><\/p>\n<p>The default Firefox profile is not very automation friendly.\u00a0 When you want to run automation reliably on a Firefox browser it is advisable to make a separate profile. Automation profile should be light to load and have desired plug ins to run and debug the test while writing automation test suite.<\/p>\n<p>1- You may want to set the User preferences of the browser like home page URL,which you want to use as your home page. The Firefox profile which web driver open does not have such preference with it, till you not have set it explicitly to the Firefox profile.<\/p>\n<p>2- Each time Selenium starts a new session driving a Firefox instance, it copies the entire profile in some temporary directory and if the profile is big, it makes it, not only slow but unreliable as well. Using a specified profile will not load a profile each time hence make it fast and more reliable.<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Make a New Profile using Firefox profile manager<\/strong><\/h3>\n<p>&nbsp;<\/p>\n<h5>Step 1: Starting the Profile Manager<\/h5>\n<ol>\n<li>Close the Firefox browser<\/li>\n<li>Press \u2018 Window\u00a0<strong>+ R\u2019<\/strong>\u00a0or click on the Windows\u00a0Start\u00a0Menu and then\u00a0select\u00a0<strong>Run<\/strong>.<\/li>\n<li>In the\u00a0<strong>Run<\/strong>\u00a0dialog box, type in: \u2018<em>firefox.exe -p<strong>&#8216;<\/strong><\/em><strong><em>\u00a0<\/em><\/strong>and then Click\u00a0<strong>OK.<\/strong><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-16367\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/12\/FF-Profile-1-300x169.png\" alt=\"FF-Profile-1\" width=\"300\" height=\"169\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2014\/12\/FF-Profile-1-300x169.png 300w, \/blog\/wp-ttn-blog\/uploads\/2014\/12\/FF-Profile-1.png 442w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/li>\n<li>The Choose User Profile window will look like this.<a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/12\/FF-Profile-2.png\"><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-16368\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/12\/FF-Profile-2-300x243.png\" alt=\"FF-Profile-2\" width=\"300\" height=\"243\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2014\/12\/FF-Profile-2-300x243.png 300w, \/blog\/wp-ttn-blog\/uploads\/2014\/12\/FF-Profile-2.png 391w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h5>Step 2:\u00a0Creating a Profile<\/h5>\n<ol>\n<li>Click the \u2018Create Profile\u2026\u2019 button on the \u2018Firefox \u2013 Choose User Profile\u2019 window<\/li>\n<li>Click \u2018Next &gt;\u2019 in the \u2018Create Profile Wizard\u2019 window<\/li>\n<li>Type in a new profile name \u2018QAProfile\u2019 in the \u2018Enter new profile name box and click \u2018Finish\u2019.<a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/12\/FF-Profile-3.png\"><br \/>\n<\/a><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/12\/QAProfile.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-medium wp-image-16381\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/12\/QAProfile-300x227.png\" alt=\"QAProfile\" width=\"300\" height=\"227\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2014\/12\/QAProfile-300x227.png 300w, \/blog\/wp-ttn-blog\/uploads\/2014\/12\/QAProfile.png 560w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h5>Step 3: Use Custom Profile in Selenium<\/h5>\n<p><code><br \/>\nProfilesIni profile = new ProfilesIni();<\/code><br \/>\n<code><br \/>\nFirefoxProfile myprofile = profile.getProfile(\"QAProfile\");<\/code><br \/>\n<code><br \/>\nWebDriver driver = new FirefoxDriver(myprofile);<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Cheers<br \/>\nGaurav Gupta<br \/>\ngaurav.gupta[at]intelligrape[dot]com<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Firefox Profile Firefox saves your browser information such as Bookmarks, Downloads and Browsing History, etc in a set of files called profile, which is stored in a specified location by Firefox in user file directory. You can have multiple Firefox profiles, each containing a separate set of user information. The\u00a0Profile Manager allows you [&hellip;]<\/p>\n","protected":false},"author":144,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":8},"categories":[7,1],"tags":[1561,25,1562,1563,1575],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/16361"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/144"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=16361"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/16361\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=16361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=16361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=16361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}