28 August, 2015

Different Preferences available in Firefox for Selenium

In Selenium we usually came across a situations where really don't want Browser Dialog box to pop-up or say we need to change the path of Downloads only for our Automation script and more say we want to set some URL to be opened on starting up a new tab/page every time, or Disable to tool bar tips or disable the warn messages for Close.

Selenium cant automate the objects which is outside of web page scope so to really make the automation go through we can use below provided methods with Preferences of Firefox profile.

browser.download.folderList 
The  browser.download.folderList Preference in Firefox's about:config interface allows the user to choose between one of three pre specified locations in which to store file downloads. Its Default Value is 1.
The value of browser.download.folderList can be set to either 0, 1, or 2.
  • When set to 0, Firefox will save all files downloaded via the browser    on the user's desktop.
  • When set to 1, these downloads are stored in the Downloads folder.
  • When set to 2, the location specified for the most recent download is utilized again.

browser.download.manager.showWhenStarting
The browser.download.manager.showWhenStarting Preference in Firefox's about:config interface allows the user to specify whether or not the Download Manager window is displayed when a file download is initiated.
The value of browser.download.manager.showWhenStarting can be set to either true or false.
  • When set to true, which is the default value, Firefox's Download Manager window will appear each time a download begins.
  • When set to false, this window will be hidden.

browser.startup.page
The value of browser.startup.page can be set to one of four integers: 0, 1, 2, or 3.
  • When this Preference is set to 0, a blank page (about:blank) is opened upon launch.
  • The default value, which is set to 1, causes Firefox to open whatever page(s) is set as the browser's home page.
  • When the value is set to 2, the Web page that the user last visited is opened.
  • Finally, when the value is set to 3, the user's previous browsing session is restored.

browser.chrome.toolbar_tips
The value of browser.chrome.toolbar_tips can be set to either true or false.
  • When set to true, which is the default setting, Firefox will display tool-tips containing helpful text whenever the mouse cursor hovers over specific elements. Some of these elements include bookmarks and  toolbar buttons as well as certain items within Web pages.
  • When set to false, these tool-tips are never displayed.

browser.tabs.warnOnClose
The value of browser.tabs.warnOnClose can be set to either true or false.
  • When set to true, Firefox will display a warning message (which requires user confirmation) if the browser is shut down while more than one tab is open.
  • When set to false, this warning message will never be displayed upon close.