[英]How do you use a firefox plugin within a selenium webdriver program written in java?
I was trying to run a selenium script that clicks on one of my firefox plugins in my toolbar. 我试图运行一个selenium脚本,点击我的工具栏中的一个firefox插件。 Is it possible to do this?
是否有可能做到这一点?
Actually you can't click on the element since it's not a web page element. 实际上你不能点击元素,因为它不是一个网页元素。 However you can create a profile for firefox and include addons in that profile that is launched by the webdriver applications.
但是,您可以为firefox创建配置文件,并在该配置文件中包含由webdriver应用程序启动的插件。 This will allow you to have access to Firebug or other addons.
这将允许您访问Firebug或其他插件。 I'm not sure of the interaction between the addons myself since I don't use this but the way you set a profile and extend the profile with the addon api is like so:
我不确定插件本身之间的交互,因为我不使用它,但你设置配置文件和使用插件api扩展配置文件的方式是这样的:
File file = new File("firebug-1.8.1.xpi");
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.addExtension(file);
firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.8.1"); // Avoid startup screen
WebDriver driver = new FirefoxDriver(firefoxProfile);
Referenced - http://code.google.com/p/selenium/wiki/FirefoxDriver 参考 - http://code.google.com/p/selenium/wiki/FirefoxDriver
You can automate the above scenario by using an automation tool called "Autoit". 您可以使用名为“Autoit”的自动化工具自动执行上述方案。 We just need to write a small script for clicking on the respective co-ordinates with the help of this tool.
我们只需要编写一个小脚本,在此工具的帮助下点击相应的坐标。 You can refer: http://www.autoitscript.com/site/autoit/
您可以参考: http : //www.autoitscript.com/site/autoit/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.