Initializes a new instance of the class. The object used to execute commands. The object used to configure the driver session.
(ICommandExecutor executor, ICapabilities capabilities)
| 48 | /// <param name="executor">The <see cref="ICommandExecutor"/> object used to execute commands.</param> |
| 49 | /// <param name="capabilities">The <see cref="ICapabilities"/> object used to configure the driver session.</param> |
| 50 | protected WebDriver(ICommandExecutor executor, ICapabilities capabilities) |
| 51 | { |
| 52 | this.CommandExecutor = executor; |
| 53 | this.elementFactory = new WebElementFactory(this); |
| 54 | this.registeredCommands.AddRange(DriverCommand.KnownCommands); |
| 55 | |
| 56 | if (this is ISupportsLogs) |
| 57 | { |
| 58 | // Only add the legacy log commands if the driver supports |
| 59 | // retrieving the logs via the extension end points. |
| 60 | this.RegisterDriverCommand(DriverCommand.GetAvailableLogTypes, new HttpCommandInfo(HttpCommandInfo.GetCommand, "/session/{sessionId}/se/log/types"), true); |
| 61 | this.RegisterDriverCommand(DriverCommand.GetLog, new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/se/log"), true); |
| 62 | } |
| 63 | |
| 64 | try |
| 65 | { |
| 66 | this.StartSession(capabilities); |
| 67 | } |
| 68 | catch (Exception) |
| 69 | { |
| 70 | try |
| 71 | { |
| 72 | // Failed to start driver session, disposing of driver |
| 73 | this.Dispose(); |
| 74 | } |
| 75 | catch |
| 76 | { |
| 77 | // Ignore the clean-up exception. We'll propagate the original failure. |
| 78 | } |
| 79 | throw; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /// <summary> |
| 84 | /// Gets the <see cref="ICommandExecutor"/> which executes commands for this driver. |
nothing calls this directly
no test coverage detected