如何使用selenium在firefox中调用插件

如何使用selenium在firefox中调用插件,selenium,selenium-rc,Selenium,Selenium Rc,我可以使用selenium从firefox/chrome中调用插件吗?我的要求是,我必须单击并打开firefox中的插件并执行一些操作。假设我必须在firefox中调用script cover插件,您可以使用firefox执行以下操作: FirefoxProfile profile = new FirefoxProfile(); profile.addExtension(new File(ClassLoader.getSystemResource("path/to/.xpi").getFile(

我可以使用selenium从firefox/chrome中调用插件吗?我的要求是,我必须单击并打开firefox中的插件并执行一些操作。假设我必须在firefox中调用script cover插件,您可以使用firefox执行以下操作:

FirefoxProfile profile = new FirefoxProfile();
profile.addExtension(new File(ClassLoader.getSystemResource("path/to/.xpi").getFile()));
WebDriver driver = new FirefoxDriver(profile);
我敢打赌,为Chrome设置的东西会非常相似。注:上述内容适用于硒2

编辑RC指令:

您需要运行服务器(在概要文件管理器中创建概要文件后):

java-jar selenium-server.jar-firefoxProfileTemplate“”

您可以查看进一步的说明。

是否可以使用selenium RC?
java -jar selenium-server.jar -firefoxProfileTemplate “<Selenium Profile Directory>”