我需要一种自动化的方法来在Firefox Selenium Webdriver中启用Flash,而无需用户交互。
我努力了:
FirefoxProfile profile = new FirefoxProfile();
//As 0 is to disable, I used 1. I don"t know what to use.
profile.setPreference("plugin.state.flash", 1);
WebDriver driver = new FirefoxDriver(profile);
但这仍然需要我单击“允许”。
我自己找到了解决方案。
这篇文章展示了如何在Python中禁用Adobe Flash Player
并在“ JAVA”中启用它,只需将false更改为true。
profile.setPreference("dom.ipc.plugins.enabled.libflashplayer.so","true");
它有效:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句