How to enable Flash to HTMLUnit?

久未见 提交于 2019-12-06 15:50:05

I found it with the help for this i have downgrade my HTMLUnit version from 2.15 to 2.13 as in 2.15 BrowserVersionFeatures.JS_FRAME_RESOLVE_URL_WITH_PARENT_WINDOW seems deprecated and don't know what feature replaced here.

   private static BrowserVersion firefox17WithUptoDateFlash = new BrowserVersion(BrowserVersion.FIREFOX_17.getApplicationName(),        BrowserVersion.FIREFOX_17.getApplicationVersion(),        BrowserVersion.FIREFOX_17.getUserAgent(),        BrowserVersion.FIREFOX_17.getBrowserVersionNumeric(),new BrowserVersionFeatures[]{
    BrowserVersionFeatures.JS_FRAME_RESOLVE_URL_WITH_PARENT_WINDOW,
    BrowserVersionFeatures.STYLESHEET_HREF_EXPANDURL,
    BrowserVersionFeatures.STYLESHEET_HREF_STYLE_NULL
});
static {
    PluginConfiguration plugin1 = new PluginConfiguration(
            "Shockwave Flash",
            "Shockwave Flash 11.4 r402",
            "NPSWF32_11_4_402_287.dll");
    plugin1.getMimeTypes().add(new PluginConfiguration.MimeType(
            "application/x-shockwave-flash", 
            "Adobe Flash movie",
            "swf"));
    firefox17WithUptoDateFlash.getPlugins().add(plugin1);
}
   final WebClient webClient = new WebClient(firefox17WithUptoDateFlash);

Here newly written browser instance will give support to htmlunit to act as flash enabled GUI-less browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!