我正在尝试在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(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();
}
不确定我在这里做错了什么,所有帮助将不胜感激! :)
答案 0 :(得分:1)
从上面粘贴的代码中可以看出,“ appiumVersion”功能存在输入错误:
caps.setCapability("appiumVersoin", "1.7.2");
应该是
caps.setCapability("appiumVersion", "1.7.2");