Java 使用Appium在真实设备上自动化移动Safari并遇到未捕获的异常

Java 使用Appium在真实设备上自动化移动Safari并遇到未捕获的异常,java,ios,selenium,junit,appium,Java,Ios,Selenium,Junit,Appium,使用最新的appium版本与完全配置的iOS 7设备通信 我可以让Webdriver构建并与我的appium服务器通信 我可以让SafariLauncher从xcode构建并在我的设备上运行 但是当我尝试使用java代码使用appium服务器调用SafariLauncher并在我的设备上运行它时,我得到了以下“uncaughtException” 我试着让appium使用它自己版本的SafariLauncher,我得到了一个稍微不同但同样阻塞的错误,即“无法创建新会话”。将所需功能切换到我自己本

使用最新的appium版本与完全配置的iOS 7设备通信

我可以让Webdriver构建并与我的appium服务器通信

我可以让SafariLauncher从xcode构建并在我的设备上运行

但是当我尝试使用java代码使用appium服务器调用SafariLauncher并在我的设备上运行它时,我得到了以下“uncaughtException”

我试着让appium使用它自己版本的SafariLauncher,我得到了一个稍微不同但同样阻塞的错误,即“无法创建新会话”。将所需功能切换到我自己本地构建的SafariLauncher.app版本后,我得到了新的“uncaughtException”错误



这是我试图运行的脚本-

import static org.junit.Assume.assumeTrue;



import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class test {


    WebDriver driver;


  private static boolean isSupportedPlatform() {
    Platform current = Platform.getCurrent();
    return Platform.MAC.is(current) || Platform.WINDOWS.is(current);

  }

  @Before

  synchronized public void createDriver() {
    assumeTrue(isSupportedPlatform());

    try {
        //setup the web driver and launch the webview app.
        DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
        desiredCapabilities.setCapability("app", "/Users/accesso/Library/Developer/Xcode/DerivedData/SafariLauncher-cquscfvgyludjdaolkpikgbmowez/Build/Products/Debug-iphoneos/SafariLauncher.app");
        desiredCapabilities.setCapability("device", "iphone");
        URL url = new URL("http://0.0.0.0:3001/wd/hub");
        driver = new RemoteWebDriver(url, desiredCapabilities);
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

  }

  @After
  public void quitDriver() {
    driver.quit();
  }

  @Test
  public void shouldBeAbleToPerformAGoogleSearch() {
    driver.get("http://store.accesso.com/CF-KBF");

  }
}

试试Appium最新的15版

我遇到了同样的问题,更新Appium版本解决了这个问题


我正在使用MAC mini和IPAD搭配APPIUM。

此链接可能会有所帮助。。。。您是否在设置中检查uiautomation是否已打开?
import static org.junit.Assume.assumeTrue;



import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class test {


    WebDriver driver;


  private static boolean isSupportedPlatform() {
    Platform current = Platform.getCurrent();
    return Platform.MAC.is(current) || Platform.WINDOWS.is(current);

  }

  @Before

  synchronized public void createDriver() {
    assumeTrue(isSupportedPlatform());

    try {
        //setup the web driver and launch the webview app.
        DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
        desiredCapabilities.setCapability("app", "/Users/accesso/Library/Developer/Xcode/DerivedData/SafariLauncher-cquscfvgyludjdaolkpikgbmowez/Build/Products/Debug-iphoneos/SafariLauncher.app");
        desiredCapabilities.setCapability("device", "iphone");
        URL url = new URL("http://0.0.0.0:3001/wd/hub");
        driver = new RemoteWebDriver(url, desiredCapabilities);
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

  }

  @After
  public void quitDriver() {
    driver.quit();
  }

  @Test
  public void shouldBeAbleToPerformAGoogleSearch() {
    driver.get("http://store.accesso.com/CF-KBF");

  }
}