'reference to setCapability is ambiguous' 在 Appium Java 项目上 Android Caps

'reference to setCapability is ambiguous' on Appium Java project for Android Caps

我正在开发 Appium-Java maven 驱动的框架并在 Android 功能

中遇到以下错误

reference to setCapability is ambiguous

[ERROR] both method setCapability(java.lang.String,java.lang.String) in org.openqa.selenium.MutableCapabilities and method setCapability(java.lang.String,org.openqa.selenium.Platform) in org.openqa.selenium.MutableCapabilities match

版本:

Selenium Version:<selenium.java.version>3.11.0</selenium.java.version> [Also tried with 3.141.59, 3.12.0, 3.7.1]
And Appium version:
<appium.java-client.version>6.1.0</appium.java-client.version>

代码片段:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", JsonPath.read(jsonFile, "$." + "platformName"));

JsonPath.read 到 String 的类型转换输出解决了问题。

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", (String) JsonPath.read(jsonFile, "$." + "platformName"));