Firefox有很多问题。对于大多数人来说,我发现了许多使用FirefoxDriver
对象的解决方案。但是我需要使用RemoteWebDriver
。
我的问题的所有解决方案都使用FirefoxProfile
对象。有没有办法将此个人资料用于IWebDriver
?
我需要做的一件事是使用配置文件来执行此操作:
Firefox webdriver opens first run page all the time
以下是我使用IWebDriver
的方式:
driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox(), TimeSpan.FromSeconds(timeout));
答案 0 :(得分:1)
首先创建FirefoxProfile
,然后将其添加到功能中:
// create the profile
var profile = new FirefoxProfile();
// create the capabilities
var capabilities = DesiredCapabilities.Firefox();
capabilities.SetCapability(FirefoxDriver.ProfileCapabilityName, profile.ToBase64String());
// start the remote driver
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capabilities);