Manage a Selenium Grid (Remote) Server in standalone mode. This class contains functionality for downloading the server and starting/stopping it. For more information on Selenium Grid, see: - https://www.selenium.dev/documentation/grid/getting_started/ Args: host: Host
| 28 | |
| 29 | |
| 30 | class Server: |
| 31 | """Manage a Selenium Grid (Remote) Server in standalone mode. |
| 32 | |
| 33 | This class contains functionality for downloading the server and starting/stopping it. |
| 34 | |
| 35 | For more information on Selenium Grid, see: |
| 36 | - https://www.selenium.dev/documentation/grid/getting_started/ |
| 37 | |
| 38 | Args: |
| 39 | host: Hostname or IP address to bind to (determined automatically if not specified). |
| 40 | port: Port to listen on (4444 if not specified). |
| 41 | path: Path/filename of existing server .jar file (Selenium Manager is used if not specified). |
| 42 | version: Version of server to download (latest version if not specified). |
| 43 | log_level: Logging level to control logging output ("INFO" if not specified). |
| 44 | Available levels: "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST". |
| 45 | env: Mapping that defines the environment variables for the server process. |
| 46 | java_path: Path to the java executable to run the server. |
| 47 | args: Arguments for the standalone server command. Defaults to enabling Selenium |
| 48 | Manager and managed downloads; pass a list to override these entirely (e.g. to |
| 49 | pin drivers with "--driver-configuration"). |
| 50 | """ |
| 51 | |
| 52 | DEFAULT_ARGS = ("--selenium-manager", "true", "--enable-managed-downloads", "true") |
| 53 | |
| 54 | def __init__( |
| 55 | self, |
| 56 | host=None, |
| 57 | port=4444, |
| 58 | path=None, |
| 59 | version=None, |
| 60 | log_level="INFO", |
| 61 | env=None, |
| 62 | java_path=None, |
| 63 | startup_timeout=10, |
| 64 | args=None, |
| 65 | ): |
| 66 | if path and version: |
| 67 | raise TypeError("Not allowed to specify a version when using an existing server path") |
| 68 | |
| 69 | self.host = host |
| 70 | self.port = port |
| 71 | self.path = path |
| 72 | self.version = version |
| 73 | self.log_level = log_level |
| 74 | self.env = env |
| 75 | self.java_path = java_path |
| 76 | self.startup_timeout = startup_timeout |
| 77 | self.args = list(args) if args is not None else list(self.DEFAULT_ARGS) |
| 78 | self.process = None |
| 79 | |
| 80 | @property |
| 81 | def startup_timeout(self): |
| 82 | return self._startup_timeout |
| 83 | |
| 84 | @startup_timeout.setter |
| 85 | def startup_timeout(self, timeout): |
| 86 | self._startup_timeout = int(timeout) |
| 87 |
no outgoing calls