• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Programming Languages
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
  • Automation Tools and Different Tools
    • Web Automation
      • Selenium with Java
        • Selenium Basic
        • Selenium Advance
        • Selenium Realtime
        • Framework
        • Selenium Interview
        • Selenium Videos
        • Selenium with Docker
      • Selenium with Python
      • WebdriverIO
        • Selenium Webdriver C# Tutorial
      • Cypress
      • Playwright
    • TestNG
    • Cucumber
    • Mobile Automation
      • Appium
    • API Testing
      • Postman
      • Rest Assured
      • SOAPUI
    • testRigor
    • Katalon
    • TestProject
    • Serenity BDD
    • Gradle- Build Tool
    • RPA-UiPath
    • Protractor
    • Windows Automation
  • Automation For Manual Testers
  • Services
  • Online Training
  • Contact us
  • About me
  • Follow us
    • Linkedin
    • Facebook Group
    • Facebook Page
    • Instagram

Automation

Selenium WebDriver tutorial Step by Step

You are here: Home / Basic Selenium / Simple step to start Default Firefox Profile in Selenium

Simple step to start Default Firefox Profile in Selenium

May 12, 2016 by Mukesh Otwani Leave a Comment

Default Firefox Profile in Selenium

Welcome back to another post of Selenium Webdriver in this post I will show you how to start default Firefox profile in Selenium Webdriver.

While working with Firefox in Selenium you have noticed that it starts the fresh profile every time so you will not get any cookies, form data and any plugin or add-on, which you have installed on your local browser.

 

What is Firefox Profile?

Ans- Firefox or any other browser contain your normal data like- saved data, history, cookies, add-on and all information which is generally called Firefox Profile and using Selenium we can access these profiles and operation can be performed.

You can create an own profile and can use throughout your Selenium script execution.

Default Firefox Profile in Selenium

 

Usage of Default Firefox Profile in Selenium

If you want to start default, profile every time when you execute your test so that you do not have to handle two instances of the same browser then you can do using FirefoxProfile class in Selenium.

I have used the Firefox profile while downloading the file in Selenium so if you have still not visited then check below post for more usage of Firefox Profile.

How to download file in Selenium

 

If you want to check from where we get default profile.

Step 1- Close all Firefox Instance

Step 2- Open run

Step 3- Type firefox.exe –p

Default Firefox Profile in Selenium

Step 4- Hit enter

Step 5- Check whether you have default profile in the `list. If yes then below code will work fine.

Default Firefox Profile in Selenium

 

Please use below code to start default Firefox session.

 

Program to start Default Firefox Profile in Selenium

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.firefox.FirefoxProfile;

import org.openqa.selenium.firefox.internal.ProfilesIni;



public class FirefoxDemo {



      public static void main(String[] args) {



            // Create object of ProfilesIni class

            ProfilesIni init=new ProfilesIni();



            // Get the default session  

            FirefoxProfile profile=init.getProfile("default");



           // Pass the session/profile to FirefoxDriver 

            WebDriver driver=new FirefoxDriver(profile);



            driver.get("https://learn-automation.com/");



            driver.quit();



      }



}

 

Output- After running your code you will get Firefox with preinstalled cookies, Add-on and all the details, which saved earlier.

 

Hope you enjoyed this article if any doubt in Selenium then feels free to post in Selenium Forum.

For any comment or feedback please comment below section.

Filed Under: Basic Selenium Tagged With: Default Firefox Profile in Selenium

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Free Selenium Videos

https://www.youtube.com/watch?v=w_iPCT1ETO4

Search topic

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?

Stay connected via Facebook

Stay connected via Facebook

Archives

Footer

Categories

Recent Post

  • API Testing Using Postman And RestAssured
  • Disable Personalise Your Web Experience Microsoft Edge Prompt In Selenium
  • How To Fix Error: No tests found In Playwright
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Best and easy way to Group test cases in selenium

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?