Код: Выделить всё
Unable to cast object of type 'OpenQA.Selenium.Chrome.ChromeDriver' to type 'OpenQA.Selenium.Remote.RemoteWebDriver'.
Код: Выделить всё
public IWebDriver WebInit()
{
ChromeOptions options = new ChromeOptions();
options.AddArguments("--test-type");
options.AddArguments("--start-maximized");
options.AddArguments("--disable-infobars");
options.AddArguments("--disable-extensions");
options.AddAdditionalCapability("useAutomationExtension", false);
options.AddArguments("--ignore-certificate-errors");
options.AddExcludedArgument("enable-automation");
options.AddUserProfilePreference("credentials_enable_service", false);
options.AddUserProfilePreference("profile.password_manager_enabled", false);
options.AddAdditionalCapability("useAutomationExtension", false);
options.AddUserProfilePreference("download.prompt_for_download", false);
options.AddUserProfilePreference("download.default_directory", downloadFilepath);
options.AddUserProfilePreference("safebrowsing.enabled", true);
options.AddArguments("window-size=1600,900");
new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser); //this is the code used from the mentioned Github Repository
_driver = new ChromeDriver(options);
}
public void FunctionWhereIAmCallingTheWebInitFucntion()
{
_driver = WebInit()
ICapabilities capabilities = ((RemoteWebDriver)_driver).Capabilities; //whenever this line gets executed it throws the exception that is mentioned
}
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/723 ... o-type-ope