简体   繁体   English

你如何在用java编写的selenium webdriver程序中使用firefox插件?

[英]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.

相关问题 如何使用 Selenium webdriver 和 Java 为 firefox 设置代理? - How do I set a proxy for firefox using Selenium webdriver with Java? Selenium Webdriver(Java)与Firefox扩展/插件连接/互操作 - Selenium Webdriver (Java) connect/interoperate with a Firefox extension/plugin 在 Java 程序 (Firefox) 中使用 Selenium Webdriver 获取无法连接错误 - Getting cannot connect error using Selenium Webdriver in Java program (Firefox) 如何将Selenium Webdriver放入Java Applet中 - How to put selenium webdriver within a Java Applet 如何使用Java Selenium启用Silverlight插件? - How do you enable Silverlight plugin using Java Selenium? 如何使用Java在Selenium Webdriver中为Firefox配置文件使用相对文件路径? - How to use relative file path for firefox profile in Selenium webdriver using java? 如何在JAVA中使用Selenium在firefox Webdriver上接受下载提示? - How do I accept the download prompt on the firefox webdriver using selenium in JAVA? 如何使用带有Java的Selenium Webdriver处理允许弹出的Firefox插件 - How do I handle allow pop-up of plug-in for firefox using Selenium Webdriver with Java 你如何使用Selenium在一个框架内执行javascript? - How do you use Selenium to execute javascript within a frame? 如何使用Java WebDriver中的线程运行firefox的两个实例 - How do you run two instances of firefox using threads in java webdriver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM