Nuno André
Nuno André

Reputation: 5387

Selenium Remote Webdriver with remote profile

Is it possible to open a Selenium Remote Webdriver with a specific remote profile (not temporary) in the server?

I have only been able to pass a browser_profile from the client. If I instantiate the class without browser_profile Selenium creates a new temporary profile in the server.

from selenium import webdriver

class Remote(webdriver.Remote):
    def __init__(self, **kwargs):
        capabilities = {_**whatever_}

        super().__init__(
            command_executor='http://HOST:PORT/wd/hub',
            desired_capabilities=capabilities.copy(),
            browser_profile=webdriver.FirefoxProfile(_what?_)
        )

Upvotes: 8

Views: 2540

Answers (2)

jmunsch
jmunsch

Reputation: 24139

here's what I was looking for:

            fp = webdriver.FirefoxProfile()
            fp.set_preference("browser.startup.homepage_override.mstone", "ignore")
            fp.set_preference("focusmanager.testmode", True)
            fp.update_preferences()

            driver = webdriver.Remote(
                command_executor='http://127.0.0.1:4444/wd/hub',
                desired_capabilities={'browserName': 'firefox', 'javascriptEnabled': True},
                browser_profile=fp
            )

reference:

Upvotes: 0

Falloutcoder
Falloutcoder

Reputation: 1011

No, it is not possible to pass path of remote profile in case of remote webdriver. The reason being that all remote communication is handled by command executor. Where as browser profile is dealing with local file system only. Though default profile can be configured on server.

Upvotes: 3

Related Questions