Skip to content

Issue with Firefox Profiles #18

@hali4ka

Description

@hali4ka

Hi,

after updating to Firefox 8 I had the problem that my tests were not executed. The browser windows is getting opened but after that nothing happens. After I long search I find out that selenium2Lib uses default Firefox Profile which is in the installation path of the library. For some reason this can not be loaded.

I have fixed this for me locally in this way:

  1. in file _browsermanagement.py - line 332 I removed the FIREFOX_PROFILE_DIR so that this line looks like this now:
    browser = webdriver.Firefox(webdriver.FirefoxProfile())
  2. changes in firefox_profile.py - method

def init(self,profile_directory=None):

Here are two changes possible depending of this what you want to do:

2.1 if you want to use your own specified profile the method will looks like this:
self.default_preferences = copy.deepcopy(FirefoxProfile.DEFAULT_PREFERENCES)
self.profile_dir = '<PATH_TO_YOUR_FF_PROFILE>'

    self._read_existing_userjs()
    self.extensionsDir = os.path.join(self.profile_dir, "extensions")
    self.userPrefs = os.path.join(self.profile_dir, "user.js")

2.2 If you want that every time anonymous profile is created in the temp folder and used that it will look like this:

    self.default_preferences = copy.deepcopy(FirefoxProfile.DEFAULT_PREFERENCES)
    self.profile_dir = profile_directory
    if self.profile_dir is None:
        self.profile_dir = self._create_tempfolder()
    else:
        newprof = os.path.join(tempfile.mkdtemp(),
            "webdriver-py-profilecopy")
        shutil.copytree(self.profile_dir, newprof)
        self.profile_dir = newprof
    self._read_existing_userjs()
    self.extensionsDir = os.path.join(self.profile_dir, "extensions")
    self.userPrefs = os.path.join(self.profile_dir, "user.js")

Will it be possible to fix this in future releases, so that no code changes are needed after update?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions