Skip to content

Commit

Permalink
Feat: pass capabilities to firefox (#201)
Browse files Browse the repository at this point in the history
Co-authored-by: Raphaël Roy <raphael.roy@bluemind.net>
  • Loading branch information
rafutek and Raphaël Roy authored Jul 13, 2021
1 parent 887d081 commit ad6d5d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pylenium/webdriver_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -213,16 +215,18 @@ 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.
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)


Expand Down

0 comments on commit ad6d5d6

Please sign in to comment.