@@ -157,6 +157,61 @@ public ChromeDriver(ChromeDriverService service, ChromeOptions options, TimeSpan
157157 this . AddCustomChromeCommands ( ) ;
158158 }
159159
160+ /// <summary>
161+ /// Initializes a new instance of the <see cref="ChromeDriver"/> class using the specified command executor and options.
162+ /// </summary>
163+ /// <param name="commandExecutor">The <see cref="ICommandExecutor"/> to use for executing commands.</param>
164+ /// <param name="options">The <see cref="ChromeOptions"/> to use for this driver.</param>
165+ /// <param name="autoStartSession">Whether to automatically start the session.</param>
166+ protected ChromeDriver ( ICommandExecutor commandExecutor , ChromeOptions options , bool autoStartSession )
167+ : base ( commandExecutor , options , autoStartSession )
168+ {
169+ if ( autoStartSession )
170+ {
171+ this . AddCustomChromeCommands ( ) ;
172+ }
173+ }
174+
175+ /// <summary>
176+ /// Asynchronously creates and starts a new instance of the <see cref="ChromeDriver"/> class with default options.
177+ /// </summary>
178+ /// <returns>A task that represents the asynchronous operation. The task result contains the initialized <see cref="ChromeDriver"/>.</returns>
179+ public static Task < ChromeDriver > StartAsync ( )
180+ {
181+ return StartAsync ( new ChromeOptions ( ) ) ;
182+ }
183+
184+ /// <summary>
185+ /// Asynchronously creates and starts a new instance of the <see cref="ChromeDriver"/> class using the specified options.
186+ /// </summary>
187+ /// <param name="options">The <see cref="ChromeOptions"/> to be used with the Chrome driver.</param>
188+ /// <returns>A task that represents the asynchronous operation. The task result contains the initialized <see cref="ChromeDriver"/>.</returns>
189+ /// <exception cref="ArgumentNullException">If <paramref name="options"/> is <see langword="null"/>.</exception>
190+ public static async Task < ChromeDriver > StartAsync ( ChromeOptions options )
191+ {
192+ if ( options is null )
193+ {
194+ throw new ArgumentNullException ( nameof ( options ) , "Chrome options must not be null" ) ;
195+ }
196+
197+ ChromeDriverService service = ChromeDriverService . CreateDefaultService ( ) ;
198+ ICommandExecutor executor = await GenerateDriverServiceCommandExecutorAsync ( service , options , DefaultCommandTimeout ) . ConfigureAwait ( false ) ;
199+
200+ ChromeDriver driver = new ( executor , options , autoStartSession : false ) ;
201+ driver . AddCustomChromeCommands ( ) ;
202+
203+ try
204+ {
205+ await driver . StartSessionAsync ( options . ToCapabilities ( ) ) . ConfigureAwait ( false ) ;
206+ return driver ;
207+ }
208+ catch
209+ {
210+ driver . Dispose ( ) ;
211+ throw ;
212+ }
213+ }
214+
160215 /// <summary>
161216 /// Gets a read-only dictionary of the custom WebDriver commands defined for ChromeDriver.
162217 /// The keys of the dictionary are the names assigned to the command; the values are the
0 commit comments