55import json
66import logging
77import os
8+ import pathlib
89import platform
910import random
1011import re
@@ -65,6 +66,7 @@ def __init__(self, headless=False):
6566 self ._driver = None
6667 self ._headless = headless
6768 self ._page_load_strategy = PageLoadStrategy .NORMAL
69+ self ._binary_path = None
6870
6971 self ._clipboard = ""
7072
@@ -232,6 +234,27 @@ def page_load_strategy(self, page_load_strategy: PageLoadStrategy):
232234 logger .warning ("Browser is running. Invoke stop_browser and start browser for changes to take effect." )
233235 self ._page_load_strategy = page_load_strategy
234236
237+ @property
238+ def binary_path (self ):
239+ """The binary path to be used.
240+
241+ Returns:
242+ binary_path (pathlib.Path): The binary path to be used.
243+ """
244+ return pathlib .Path (self ._binary_path )
245+
246+ @binary_path .setter
247+ def binary_path (self , binary_path : str ):
248+ """The binary path to be used.
249+
250+ Args:
251+ binary_path (str): The binary path to be used.
252+ """
253+ path = pathlib .Path (binary_path )
254+ if not path .is_file ():
255+ raise ValueError ("There is no file in the binary path." )
256+ self ._binary_path = path
257+
235258 def start_browser (self ):
236259 """
237260 Starts the selected browser.
@@ -253,7 +276,7 @@ def check_driver():
253276 func_def_capabilities = BROWSER_CONFIGS .get (self .browser ).get ("capabilities" )
254277
255278 opt = self .options or func_def_options (
256- self .headless , self ._download_folder_path , None , self .page_load_strategy
279+ self .headless , self ._download_folder_path , None , self .page_load_strategy , self . _binary_path
257280 )
258281 cap = self .capabilities or func_def_capabilities ()
259282 self .options = opt
0 commit comments