![](/img/trans.png)
[英]How do I set a proxy for firefox using Selenium webdriver with Java?
[英]How do you use a firefox plugin within a selenium webdriver program written in java?
我試圖運行一個selenium腳本,點擊我的工具欄中的一個firefox插件。 是否有可能做到這一點?
實際上你不能點擊元素,因為它不是一個網頁元素。 但是,您可以為firefox創建配置文件,並在該配置文件中包含由webdriver應用程序啟動的插件。 這將允許您訪問Firebug或其他插件。 我不確定插件本身之間的交互,因為我不使用它,但你設置配置文件和使用插件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);
您可以使用名為“Autoit”的自動化工具自動執行上述方案。 我們只需要編寫一個小腳本,在此工具的幫助下點擊相應的坐標。 您可以參考: http : //www.autoitscript.com/site/autoit/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.