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

Android端Chrome自动化启动失败:驱动版本不兼容问题咨询

Appium Chromedriver Compatibility Issue with Chrome 76 on Android

First, let's recap the core error you're hitting to set clear context:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details.
Original error: An unknown server-side error occurred while processing the command. Original error: Unable to automate Chrome version because it is too old for this version of Chromedriver.
Chrome version on the device: Chrome/76.0.3809.89
Failed to start Chromedriver session: A new session could not be created. Details: session not created: Chrome version must be between 71 and 75
(Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17763 x86_64)

Your test code for reference:

package browserTest;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class ChromeTest {
    public static void main(String args[]) {
        //Set the Desired Capabilities
        DesiredCapabilities cap = new DesiredCapabilities();
        cap.setCapability("deviceName", "My Android Mobile");
        cap.setCapability("udid", "521010f9ee4fb499");
        cap.setCapability("platformName", "Android");
        cap.setCapability("platformVersion", "7.0");
        cap.setCapability("browserName", "Chrome");
        cap.setCapability("noReset", true);
        //Instantiate Appium Driver
        AppiumDriver<MobileElement> driver = null;
        try {
            driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap);
        }catch (MalformedURLException e) {
            e.getMessage();
        }
        //Open URL in Chrome browser
        driver.get("http://www.google.com");
    }
}

1. Where does the chromedriver=2.46.628402 come from?

That outdated Chromedriver version is almost certainly coming from one of these places:

  • Appium's default bundled driver: Appium ships with a set of pre-packaged Chromedriver versions. If you don't explicitly tell it to use a different one, it will pick the latest compatible version it has stored—here, that's 2.46, which only supports Chrome 71-75.
  • System PATH variable: If you installed an older Chromedriver on your Windows machine and added its path to your system's PATH environment variable, Appium might be pulling that version instead of a newer one.
  • Unused WebDriverManager: While you imported WebDriverManager, your code doesn't actually call it to set up Chromedriver right now. So it's not influencing which driver Appium uses here.

2. How to fix the version mismatch error?

The root problem is simple: Chromedriver and Chrome must share the same major version number (76.x for your Chrome 76). Here's how to fix this step by step:

Step 1: Download the correct Chromedriver version

Grab the Chromedriver release that matches your Chrome 76.0.3809.89 build—look for the 76.x release that aligns with your Chrome's build number.

Step 2: Force Appium to use the new driver

Add a capability to your code to specify the path to your downloaded Chromedriver executable. Update your DesiredCapabilities block like this:

// Add this line after your existing capabilities
cap.setCapability("chromedriverExecutable", "C:\\your\\file\\path\\chromedriver_76.exe");

(Replace the path with the actual location where you saved the 76.x Chromedriver on your Windows machine)

Step 3: Optional: Clean up old driver references

  • Check your system's PATH variable and remove any entries pointing to older Chromedriver versions to avoid future conflicts.
  • If you want to use WebDriverManager to automate version management, add this line before initializing the driver:
    WebDriverManager.chromedriver().driverVersion("76.0.3809.126").setup();
    
    Note: Even with WebDriverManager, explicitly setting the chromedriverExecutable capability is more reliable for Appium, as it eliminates any ambiguity about which driver is used.

Step 4: Test the fix

Restart your Appium server, run your Java program again, and the session should create successfully now that the Chromedriver version matches your device's Chrome version.


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 06:47:05