For C#
Create a folder called Drivers. Add all the drivers you want, chromedriver, gecko, IE, phantom whatever. Set each to "copy always" so it goes to your bin directory.
Then create the GetBasePath method and call it accordingly. I would also create a switch statement and call whatever driver you want to use.
ex:
_webDriver = new InternetExplorerDriver(Path.Combine(GetBasePath, @"Drivers\"));
or
ChromeOptions options = new ChromeOptions();
options.AddArguments("--start-maximized");
options.AddUserProfilePreference("credentials_enable_service", false);
_webDriver = new ChromeDriver(Path.Combine(GetBasePath, @"Drivers\"), options, TimeSpan.FromMinutes(3));
public static string GetBasePath
{
get
{
var basePath =
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
return basePath;
}
}