Last active
May 29, 2020 15:56
-
-
Save jimevans/d31a14954b812b5a57d6d97c723feade to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SeleniumSessionStarter | |
| { | |
| private string userName; | |
| private string password; | |
| private string domain; | |
| private string shouldLoadUserProfile; | |
| public SeleniumSessionStarter(string userName, string password, string domain, bool shouldLoadProfile) | |
| { | |
| this.userName = userName; | |
| this.password = password; | |
| this.domain = domain; | |
| this.shouldLoadUserProfile = shouldLoadProfile; | |
| } | |
| public IWebDriver StartSeleniumSession(string userName, string password) | |
| { | |
| ChromeDriverService service = ChromeDriverService.CreateDefaultService(); | |
| service.DriverProcessStarting += OnDriverProcessStarting; | |
| IWebDriver driver = new ChromeDriver(service); | |
| return driver; | |
| } | |
| private void OnDriverProcessStarting(object sender, DriverProcessStartingEventArgs e) | |
| { | |
| e.DriverServiceProcessStartInfo.UserName = this.userName; | |
| e.DriverServiceProcessStartInfo.Password = this.password; | |
| e.DriverServiceProcessStartInfo.Domain = this.domain; | |
| e.DriverServiceProcessStartInfo.LoadUserProfile = this.shouldLoadUserProfile; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment