Create a new instance of the Firefox driver, start the service, and create new instance. Args: options: Instance of Options. service: Service object for handling the browser driver if you need to pass extra details. keep_alive: Whether to configure Firefo
(
self,
options: Options | None = None,
service: Service | None = None,
keep_alive: bool = True,
)
| 36 | CONTEXT_CONTENT = "content" |
| 37 | |
| 38 | def __init__( |
| 39 | self, |
| 40 | options: Options | None = None, |
| 41 | service: Service | None = None, |
| 42 | keep_alive: bool = True, |
| 43 | ) -> None: |
| 44 | """Create a new instance of the Firefox driver, start the service, and create new instance. |
| 45 | |
| 46 | Args: |
| 47 | options: Instance of Options. |
| 48 | service: Service object for handling the browser driver if you need to pass extra details. |
| 49 | keep_alive: Whether to configure FirefoxRemoteConnection to use HTTP keep-alive. |
| 50 | """ |
| 51 | self.service = service if service else Service() |
| 52 | self.options = options if options else Options() |
| 53 | |
| 54 | finder = DriverFinder(self.service, self.options) |
| 55 | if finder.get_browser_path(): |
| 56 | self.options.binary_location = finder.get_browser_path() |
| 57 | self.options.browser_version = None |
| 58 | |
| 59 | self.service.path = self.service.env_path() or finder.get_driver_path() |
| 60 | self.service.start() |
| 61 | |
| 62 | executor = FirefoxRemoteConnection( |
| 63 | remote_server_addr=self.service.service_url, |
| 64 | keep_alive=keep_alive, |
| 65 | ignore_proxy=self.options._ignore_local_proxy, |
| 66 | ) |
| 67 | |
| 68 | try: |
| 69 | super().__init__(command_executor=executor, options=self.options) |
| 70 | except Exception: |
| 71 | self.quit() |
| 72 | raise |
| 73 | |
| 74 | def set_context(self, context) -> None: |
| 75 | """Sets the context that Selenium commands are running in. |
nothing calls this directly
no test coverage detected