0

My goal is to use a previously saved FireFox browser profile in Remore Webdriver at Selenium Grid.

I've tried to add a profile object to DesiredCapabilities, yet failed, being a serialization error. The following code I've composed based on this JAVA code:

desired_cap = {'acceptInsecureCerts': True, 'browserName': 'firefox',
           'marionette': True, 'browserstack.debug' : True}
profile_path= os.environ['APPDATA']+os.sep+os.path.join('Mozilla','Firefox','Profiles', 'rust_mozprofile.aaaabbbb')
profile_object = webdriver.FirefoxProfile(profile_path)
desired_cap['FirefoxDriver.PROFILE'] = profile_object

Error: ... File "C:\Python27\Lib\json__init__.py", line 244, in dumps return _default_encoder.encode(obj) File "C:\Python27\Lib\json\encoder.py", line 207, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\Python27\Lib\json\encoder.py", line 270, in iterencode return _iterencode(o, 0) File "C:\Python27\Lib\json\encoder.py", line 184, in default raise TypeError(repr(o) + " is not JSON serializable") TypeError: is not JSON serializable

Any suggestions? Is it ever possible to pass Firefox profile to Remote Webdriver?

Igor Savinkin
  • 5,669
  • 8
  • 37
  • 69

1 Answers1

1

I load the profile locally with:

    self.browser = webdriver.Firefox(
        firefox_profile=profile_object,
    )

And remote.

self.browser = webdriver.Remote(
        command_executor=SELENIUM,
        browser_profile=profile_object,
        desired_capabilities= desired_cap
    )
Cynic
  • 6,779
  • 2
  • 30
  • 49