2014-02-05 77 views
0

我需要爲Firefox添加擴展 - 它是Firebug的插件並調用Omnibug。我使用Selenium WeDriver和C#。我添加了firebug.xpi和netExport.xpi,這個擴展名出現在Firefox中。此外,我添加Omnibug.xpi,但它不會出現在FF中。有任何想法嗎?Selenium WebDriver C#和Omnibug

全面上市:

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

據我所知它必須是小寫字母S IN 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);