在C#Selenium中使用Firefox配置文件不能与其他设备一起使用

时间:2017-07-02 10:19:59

标签: c# wpf selenium firefox selenium-firefoxdriver

我这样做是为了使用用户的默认Firefox配置文件:

var profileManager = new FirefoxProfileManager();
FirefoxProfile profile = profileManager.GetProfile("default");
IWebDriver driver = new FirefoxDriver(profile);

而且:

string pathToCurrentUserProfiles = Environment.ExpandEnvironmentVariables("%APPDATA%") + @"\Mozilla\Firefox\Profiles";
string[] pathsToProfiles = Directory.GetDirectories(pathToCurrentUserProfiles, "*.default", SearchOption.TopDirectoryOnly);

FirefoxProfile profile = new FirefoxProfile(pathsToProfiles[0]);
IWebDriver driver = new FirefoxDriver(profile);

而且:

var firefoxService = FirefoxDriverService.CreateDefaultService();
var options = new FirefoxOptions();
options.Profile = profile;
IWebDriver driver = new FirefoxDriver(firefoxService, options, new TimeSpan(0, 2, 0));

他们都在我的工作设备中使用我的Firefox配置文件,但是当在其他设备上使用已发布的应用程序时,应用程序看起来等待超时,然后打开geckodriver,线程现在就完成了。

这是什么问题?它在我的设备上运行良好......

0 个答案:

没有答案