Selenium Webdriver c#:初始化 FirefoxProfile 时获取 "The path is not of a legal form."
Selenium Webdriver c# : Getting "The path is not of a legal form." while initializing FirefoxProfile
我正在使用下面提到的代码来初始化带有服务、选项和超时的 firefox 驱动程序。
var Service = FirefoxDriverService.CreateDefaultService(RunConfig.DriverPath);
Service.HideCommandPromptWindow = RunConfig.HideDriverCommandPromptWindow;
var Options = new FirefoxOptions();
if (!string.IsNullOrWhiteSpace(RunConfig.PathToBrowserBinary))
Options.BrowserExecutableLocation = RunConfig.PathToBrowserBinary;
Options.Profile = new FirefoxProfile();
Options.Profile.SetPreference(Preference.Name,PathToDownloadFolder));
Options.Profile.SetPreference(Preference.Name, Preference.Value);
return new FirefoxDriver(Service, Options, TimeSpan.FromSeconds(90));
但是在初始化 firefox 配置文件时出现路径不合法的错误
解决了。问题是我使用的 seleniumwebdriver dll 存在于其他一些项目中。将 selenium webdriver 和支持 dll 添加到当前项目成功。
我正在使用下面提到的代码来初始化带有服务、选项和超时的 firefox 驱动程序。
var Service = FirefoxDriverService.CreateDefaultService(RunConfig.DriverPath);
Service.HideCommandPromptWindow = RunConfig.HideDriverCommandPromptWindow;
var Options = new FirefoxOptions();
if (!string.IsNullOrWhiteSpace(RunConfig.PathToBrowserBinary))
Options.BrowserExecutableLocation = RunConfig.PathToBrowserBinary;
Options.Profile = new FirefoxProfile();
Options.Profile.SetPreference(Preference.Name,PathToDownloadFolder));
Options.Profile.SetPreference(Preference.Name, Preference.Value);
return new FirefoxDriver(Service, Options, TimeSpan.FromSeconds(90));
但是在初始化 firefox 配置文件时出现路径不合法的错误
解决了。问题是我使用的 seleniumwebdriver dll 存在于其他一些项目中。将 selenium webdriver 和支持 dll 添加到当前项目成功。