Skip to content Skip to sidebar Skip to footer

Selenium: Firefoxprofile Fails With Not Found Exception

I've the following code, though I set the profile_directory Firefox webdriver still attempts to store setting within the /tmp folder profile = FirefoxProfile(profile_directory = '/

Solution 1:

I have same problem. As FF5 doesn't have "user.js" in profile -> we don't have to read it.

so open selenium/webdriver/firefox/firefox_profile.py and add try except after def _read_existing_userjs(self), like this:

def _read_existing_userjs(self):
    try:
        f = open(os.path.join(self.profile_dir, 'user.js'), "r")
    except IOError, e:
        print"We didn't find user.js in your profile, but that is ok"return

    tmp_usr = f.readlines()
    f.close()
    for usr in tmp_usr:
        matches = re.search('user_pref\("(.*)",\s(.*)\)', usr)
        self.default_preferences[matches.group(1)] = matches.group(2)

Post a Comment for "Selenium: Firefoxprofile Fails With Not Found Exception"