我需要为Firefox添加扩展程序 - 它是Firebug的插件并调用Omnibug。我使用Selenium WeDriver和C#。我添加了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();
}
}
答案 0 :(得分:0)
据我所知,在profile.setPreference中它必须是小写的,而不是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);