You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Watir启用Firefox Flash及自动登录失败求助

Fixing "Adobe Flash Player support enabled" Error in Watir + Firefox Automation

Hey there! I totally get how frustrating this can be—you’ve got your Watir script set up, the steps run fine, but then that Flash error pops up out of nowhere. Let’s break down how to fix this, since Firefox has pretty strict defaults around Flash these days.

First, let’s cover the core issue: Firefox disables Flash by default, even if you think your "default" profile has it turned on. Watir might not be loading your regular user profile correctly, or the profile’s Flash settings aren’t actually applied when running automation. Here are a few actionable solutions:

1. Manually Verify & Configure Your Default Firefox Profile

If you want to stick with your existing default profile, double-check these settings in your regular Firefox browser (not the one launched by Watir):

  • Go to about:addons → Plugins → Find Adobe Flash Player → Set it to Always Activate.
  • Head to about:config (click "Accept the Risk and Continue" if prompted):
    • Search for plugin.state.flash → Set its value to 2 (this means "Always enable").
    • Search for plugins.click_to_play → Set to false to skip the "click to activate" prompt.
    • For Linux, check dom.ipc.plugins.enabled.libflashplayer.so and set to true; for Windows/Mac, look for the corresponding Flash plugin key and enable it.

After updating these, close Firefox completely and run your script again—Watir should load the updated profile settings.

2. Create a Custom Profile in Your Script (More Reliable)

Using a custom profile ensures your Flash settings are always applied, no matter what your default profile’s state is. Modify your code like this:

# Create a dedicated Firefox profile for automation
profile = Selenium::WebDriver::Firefox::Profile.new

# Enable Flash globally
profile['plugin.state.flash'] = 2
# Disable click-to-play prompts for Flash
profile['plugins.click_to_play'] = false
# Allow Flash to run on your target site (add more sites if needed)
profile['plugin.exceptions.adobe-flashplayer'] = 'https://my.test.site.com/,*'
# Enable the Flash plugin process (adjust based on your OS if needed)
profile['dom.ipc.plugins.enabled.libflashplayer.so'] = true

# Launch the browser with this custom profile
ff = Watir::Browser.new :firefox, profile: profile, accept_insecure_certs: true
ff.goto 'https://my.test.site.com/'
ff.driver.manage.window.maximize
ff.text_field(id: 'login').set 'mytestuser@domain.com'
ff.text_field(id: 'password').set 'Password'
ff.button(text: 'Log In').click

3. Check Your Firefox Version

Important note: Adobe stopped supporting Flash in 2020, so modern Firefox versions (post-ESR 52) don’t include Flash support at all. If you’re using a newer Firefox, you’ll need to switch to Firefox ESR 52 (the last version that supports Flash) and install the corresponding Flash Player plugin for that version.

Give these steps a try—most likely, either configuring the profile correctly or using a custom profile will resolve that error. Let me know if you hit any snags!

内容的提问来源于stack exchange,提问作者rickman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 06:15:38