[英]Selenium WebDriver C# and Omnibug
我需要为Firefox添加扩展名-它是Firebug的插件,并调用Omnibug。 我在C#中使用Selenium WeDriver。 我添加了firebug.xpi和netExport.xpi,此扩展出现在Firefox中。 我也添加了Omnibug.xpi,但是它没有出现在FF中。 有任何想法吗?
完整清单:
class Program
{
static void Main(string[] args)
{
FirefoxProfile profile = new FirefoxProfile();
profile.Clean();
profile.AddExtension(@"D:\SELENIUM\selenium-dotnet-2.39.0\net40\netExport-0.8.xpi");
profile.AddExtension(@"D:\SELENIUM\selenium-dotnet-2.39.0\net40\firebug-1.12.0.xpi");
profile.AddExtension(@"D:\SELENIUM\selenium-dotnet-2.39.0\net40\omnibug-0.5.500.xpi");
string output_dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
output_dir = Path.Combine(output_dir, "Firebugnetexports");
profile.SetPreference("extensions.firebug.currentVersion", "1.12");
profile.SetPreference("extensions.firebug.allPagesActivation", "on");
profile.SetPreference("extensions.firebug.defaultPanelName", "net");
profile.SetPreference("extensions.firebug.net.enableSites", true);
profile.SetPreference("extensions.firebug.netexport.alwaysEnableAutoExport", true);
profile.SetPreference("extensions.firebug.netexport.showPreview", true); // preview
profile.SetPreference("extensions.firebug.netexport.sendToConfirmation", false);
profile.SetPreference("extensions.firebug.netexport.pageLoadedTimeout", 3000);
profile.SetPreference("extensions.firebug.netexport.autoExportToFile", true);
profile.SetPreference("extensions.firebug.netexport.Automation",true);
profile.SetPreference("extensions.firebug.netexport.alwaysEnableAutoExport", true);
profile.SetPreference("extensions.firebug.netexport.showPreview", false);
profile.SetPreference("extensions.firebug.netexport.defaultLogDir", output_dir);
profile.SetPreference("extensions.firebug.omnibug.enableSites", true);
profile.SetPreference("extensions.omnibug.userPattern", "om.");
profile.SetPreference("extensions.omnibug.enableFileLogging", true);
profile.SetPreference("extensions.omnibug.logFileName", "omnibug_log");
profile.SetPreference("extensions.omnibug.alwaysExpand", true);
if (!Directory.Exists(output_dir))
{
Directory.CreateDirectory(output_dir);
}
IWebDriver webDriver = new FirefoxDriver(profile);
webDriver.Navigate().GoToUrl("http://www.ringcentral.com");
Console.WriteLine(output_dir);
Console.ReadLine();
}
}
据我所知,它必须在profile.setPreference中的小写字母s中,而不是profile.SetPreference中。
如
profile.setPreference("extensions.firebug.omnibug.enableSites", true);
profile.setPreference("extensions.omnibug.userPattern", "om.");
profile.setPreference("extensions.omnibug.enableFileLogging", true);
profile.setPreference("extensions.omnibug.logFileName", "omnibug_log");
profile.setPreference("extensions.omnibug.alwaysExpand", true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.