webdriver.FirefoxProfile(): Is it possible to use a profile without making a copy of it?

As per the current implementation of GeckoDriver with Firefox using the FirefoxProfile() works as follows :

  • If case of initiating a Browsing Session through a new Firefox Profile as follows :

    from selenium import webdriver
    
    myprofile = webdriver.FirefoxProfile()
    driver = webdriver.Firefox(firefox_profile=myprofile, executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
    driver.get('https://www.google.co.in')
    print("Page Title is : %s" %driver.title)
    driver.quit()
    
  • A new rust_mozprofile gets created on the run as follows :

    1521446301607   mozrunner::runner   INFO    Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\ATECHM~1\\AppData\\Local\\Temp\\rust_mozprofile.xFayqKkZrOB8"
    
  • Of-coarse on a successful closure (i.e. successful invocation of driver.quit()) the temporary rust_mozprofile.xFayqKkZrOB8 gets deleted/destroyed completely.

  • Again in case of initiating a Browsing Session through an existing Firefox Profile() as follows :

    from selenium import webdriver
    
    myprofile = webdriver.FirefoxProfile(r'C:\Users\AtechM_03\AppData\Roaming\Mozilla\Firefox\Profiles\moskcpdq.SeleniumTest')
    driver = webdriver.Firefox(firefox_profile=myprofile, executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
    driver.get('https://www.google.co.in')
    print("Page Title is : %s" %driver.title)
    driver.quit()
    
  • Similarly a new rust_mozprofile gets created on the run as follows :

    1521447102321   mozrunner::runner   INFO    Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\ATECHM~1\\AppData\\Local\\Temp\\rust_mozprofile.2oSwrQwQoby9"
    
  • Similarly in this case as well on a successful closure (i.e. successful invocation of driver.quit()) the temporary rust_mozprofile.2oSwrQwQoby9 gets deleted/destroyed completely.

  • So the timespan you are observing is the time needed for a FirefoxProfile() to scoop out a new rust_mozprofile.

Perhaps as per your question timespan for profile to copy (something like >30 minutes) is a pure overhead. So it won’t be possible to use a Firefox Profile without making a copy of rust_mozprofile.


Solution

  • Upgrade Selenium Client to current levels Version 3.11.0.
  • Upgrade GeckoDriver to current GeckoDriver v0.20.0 level.
  • Upgrade Firefox version to Firefox Quantum v59.0.1 levels.
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
  • If your base Firefox base version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Firefox Quantum.
  • Execute your @Test.

Leave a Comment