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

Linux虚拟机执行Selenium脚本:Chrome60/Firefox52遇驱动不支持异常求助

Fixing Unsupported Driver Exception for Chrome 60 and Firefox 52 on Linux VM

Let’s get straight to solving your Unsupported Driver Exception issue—this almost always boils down to a mismatch between your browser version and its corresponding WebDriver, plus a few environment checks specific to Linux. Here’s how to fix each browser:

Chrome 60 Troubleshooting

Chrome enforces strict version alignment between the browser and ChromeDriver. For Chrome 60, you need ChromeDriver version 2.31, 2.32, or 2.33—these are the only releases officially compatible with Chrome 60.

Step-by-Step Fix:

  • First, confirm the mismatch by checking your current ChromeDriver version:
    chromedriver --version
    
  • Uninstall any existing, incompatible ChromeDriver (delete it directly if it’s in your PATH, or use your package manager if installed that way).
  • Download the correct ChromeDriver binary for your Linux architecture (32-bit or 64-bit) from the official ChromeDriver archive.
  • Make the binary executable:
    chmod +x chromedriver
    
  • Either add the ChromeDriver directory to your system PATH, or explicitly specify its path in your Selenium script:
    • Python example:
      from selenium import webdriver
      driver = webdriver.Chrome(executable_path='/path/to/your/chromedriver')
      
    • Java example:
      System.setProperty("webdriver.chrome.driver", "/path/to/your/chromedriver");
      WebDriver driver = new ChromeDriver();
      
  • Verify Chrome is properly installed and has all dependencies: Run google-chrome --version to confirm it’s Chrome 60, then use ldd google-chrome to check for missing libraries (install any gaps with your distro’s package manager, e.g., apt install libxss1 for Debian/Ubuntu).

Firefox 52 Troubleshooting

Firefox 52 relies on GeckoDriver (Mozilla dropped direct Selenium support in favor of GeckoDriver starting with Firefox 48). For Firefox 52, you need GeckoDriver version 0.14.0 to 0.16.0, paired with Selenium 3.4.0 or later.

Step-by-Step Fix:

  • Check your current GeckoDriver and Selenium versions:
    geckodriver --version
    
    • For Python:
      pip show selenium
      
    • For Java: Check your build file (pom.xml/gradle) for the Selenium dependency version.
  • If your Selenium version is older than 3.4.0, upgrade it:
    • Python:
      pip install selenium==3.4.0
      
    • Java: Update your dependency to org.seleniumhq.selenium:selenium-java:3.4.0.
  • Download the compatible GeckoDriver version (0.15.0 is a safe bet for Firefox 52) for your Linux architecture.
  • Make the binary executable:
    chmod +x geckodriver
    
  • Specify the GeckoDriver path in your script, and ensure Marionette mode is enabled (it’s default in Firefox 52, but explicit setting avoids edge cases):
    • Python example:
      from selenium import webdriver
      from selenium.webdriver.firefox.options import Options
      
      options = Options()
      options.add_argument('-marionette')
      driver = webdriver.Firefox(executable_path='/path/to/your/geckodriver', firefox_options=options)
      
    • Java example:
      System.setProperty("webdriver.gecko.driver", "/path/to/your/geckodriver");
      WebDriver driver = new FirefoxDriver();
      
  • Check Firefox dependencies with ldd firefox and install any missing libraries (e.g., apt install libgtk-3-0 for Debian/Ubuntu).

Quick Final Checks

  • Ensure your Linux VM has the necessary display support: Even if running headless, you might need xvfb to simulate a display—install it with apt install xvfb and run your script via xvfb-run python your_script.py if needed.
  • Double-check that your browser versions are exactly Chrome 60 and Firefox 52 (minor version mismatches can still trigger compatibility issues).

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 07:47:10