Appium Sauce Labs - 不支持 OS/browser/version/device 组合

Appium Sauce Labs - Unsupported OS/browser/version/device combo

我正在尝试在 Sauce Labs 中设置我的第一个 Appium 测试(不是本机或混合应用程序),并且在尝试设置我的功能时遇到 WebDriverException:

org.openqa.selenium.WebDriverException: Unable to parse remote response: Misconfigured -- Unsupported OS/browser/version/device combo: OS: 'unspecified', Browser: 'iphone', Version: '11.2.2.', Device: 'iPhone Simulator'`

这是我设置上限的方法:

public static DesiredCapabilities CreateAppiumCapabilities(String browser, String version, String platform,String device, String methodName) { 
DesiredCapabilities caps = new DesiredCapabilities(); 
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, platform); 
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, version); 
caps.setCapability(MobileCapabilityType.DEVICE_NAME, device); 
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME,"XCUITest"); 
caps.setCapability(MobileCapabilityType.BROWSER_NAME, browser); 
caps.setCapability("appiumVersoin", "1.7.2"); 
caps.setCapability("name", methodName); 
System.out.println(caps); 
return caps;

然后,在我的 testBase.java 文件中 运行 这个:

private ThreadLocal<IOSDriver> iosDriver = new ThreadLocal<IOSDriver>();

...
...
...

DesiredCapabilities capabilities = SauceUtils.CreateAppiumCapabilities(browser, version, platform, device, methodName);
                String url = SauceUtils.getURL();
                iosDriver.set(new IOSDriver(new URL(url), capabilities));
                sessionId.set(((IOSDriver) getIosDriver()).getSessionId().toString());

System.out.println(大写字母)正确显示了所有内容:

Capabilities {appiumVersoin: 1.7.2, automationName: XCUITest, browserName: Safari, deviceName: iPhone Simulator, name: appiumTest, platformName: iOS, platformVersion: 11.2.2}

实际测试如下:

public class AppiumTest extends TestBase {
    @Test(dataProvider = "appium", groups = "Appium", description = "simple appium test")
    public void appiumTest(String browser, String version, String platform, String device, Method method) throws Exception {
        this.createDriver(browser, version, null, method.getName(), device, platform);
        IOSDriver<WebElement> mobiledriver = getIosDriver();
        mobiledriver.get("http://appium.io/");
        Assert.assertEquals(mobiledriver.getCurrentUrl(), "http://appium.io/", "URL Mismatch");
        Assert.assertEquals(mobiledriver.getTitle(), "Appium: Mobile App Automation Made Awesome.", "Title Mismatch");
    }
}

getIosDriver() 函数:

    public IOSDriver<WebElement> getIosDriver() {
        return iosDriver.get();
    }

不确定我在这里做错了什么,将不胜感激任何和所有帮助! :)

从上面粘贴的代码看来,"appiumVersion" 功能中有一个错字:

caps.setCapability("appiumVersoin", "1.7.2"); 

应该是

caps.setCapability("appiumVersion", "1.7.2");