From ad6d5d6a5bc6a0cf65153d85da26815ef3a8f4db Mon Sep 17 00:00:00 2001 From: rafutek <47695845+rafutek@users.noreply.github.com> Date: Tue, 13 Jul 2021 22:23:07 +0200 Subject: [PATCH] Feat: pass capabilities to firefox (#201) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Raphaƫl Roy --- pylenium/webdriver_factory.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pylenium/webdriver_factory.py b/pylenium/webdriver_factory.py index 40a6d7a..e4dd636 100644 --- a/pylenium/webdriver_factory.py +++ b/pylenium/webdriver_factory.py @@ -125,6 +125,7 @@ def build_from_config(config: PyleniumConfig) -> WebDriver: return build_firefox( config.driver.version, config.driver.options, + config.driver.capabilities, config.driver.experimental_options, config.driver.extension_paths, config.driver.local_path) @@ -205,6 +206,7 @@ def build_edge(version: str, def build_firefox(version: str, browser_options: List[str], + capabilities: dict, experimental_options: Optional[List[dict]], extension_paths: Optional[List[str]], local_path: Optional[str]) -> WebDriver: @@ -213,6 +215,7 @@ def build_firefox(version: str, Args: version: The desired version of Firefox. browser_options: The list of options/arguments to include. + capabilities: The dict of capabilities to include. experimental_options: The list of experimental options to include. extension_paths: The list of extensions to add to the browser. local_path: The path to the driver binary. @@ -220,9 +223,10 @@ def build_firefox(version: str, Examples: driver = WebDriverFactory().build_firefox('latest', ['headless', 'incognito'], None) """ + caps = build_capabilities(Browser.FIREFOX, capabilities) options = build_options(Browser.FIREFOX, browser_options, experimental_options, extension_paths) if local_path: - return webdriver.Firefox(executable_path=local_path, options=options) + return webdriver.Firefox(executable_path=local_path, options=options, capabilities=caps) return webdriver.Firefox(executable_path=GeckoDriverManager(version=version).install(), options=options)