gpt4 book ai didi

java - Appium Sauce Labs - 不支持的操作系统/浏览器/版本/设备组合

转载 作者:行者123 更新时间:2023-11-30 05:40:55 32 4
gpt4 key购买 nike

我正在尝试在 Sauce Labs 中设置我的第一个 Appium 测试(不是 native 或混合应用程序),并且在尝试设置我的功能时遇到 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(caps) 正确显示所有内容:

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"); 

关于java - Appium Sauce Labs - 不支持的操作系统/浏览器/版本/设备组合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55693317/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com