How do you use a firefox plugin within a selenium webdriver program written in java?

后端 未结 2 1702
时光说笑
时光说笑 2020-12-03 14:57

I was trying to run a selenium script that clicks on one of my firefox plugins in my toolbar. Is it possible to do this?

相关标签:
2条回答
  • 2020-12-03 15:10

    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. This will allow you to have access to Firebug or other addons. 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:

    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

    0 讨论(0)
  • 2020-12-03 15:21

    You can automate the above scenario by using an automation tool called "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/

    0 讨论(0)
提交回复
热议问题