2017-10-08 16 views
0

これはちょっと奇妙な状況です。私が手動でappium GUIサーバを起動し、appium javaテストを実行すると、iOSシミュレータが開き、アプリケーションが期待どおりに起動します。問題は、サーバーがJavaコードから起動され、接続が成功し、シミュレータが開きますが、シミュレータにそこに座っていても起動されません。iOSアプリは、appiumサーバーがプログラムで起動されても起動しません。

テストがエラーで失敗します。

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: simctl error running 'uninstall': An error was encountered processing the command (domain=LSApplicationWorkspaceErrorDomain, code=111): 
The operation couldn’t be completed. (LSApplicationWorkspaceErrorDomain error 111.) 

CoreSimulator.logはエラーを示しています

<Error>: uninstallApplication:withOptions:error:: Error Domain=LSApplicationWorkspaceErrorDomain Code=111 "(null)" UserInfo={optionsDict={ 
     SimulatorRootPath = "/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 10.3.simruntime/Contents/Resources/RuntimeRoot"; 
     SimulatorUserPath = "/Users/Library/Developer/CoreSimulator/Devices/4C54BEC0-5A37-418A-8C32-CC9168538FBF/data"; 
    }, CFBundleIdentifier=com.apple.test.WebDriverAgentRunner-Runner} 

マイコード:

private AppiumDriverLocalService service; 
    WebDriver driver; 

@BeforeClass(alwaysRun=true) 
public void startServer() throws InterruptedException, MalformedURLException { 

AppiumDriverLocalService service = AppiumDriverLocalService 
          .buildService(new AppiumServiceBuilder().usingDriverExecutable(new File("/usr/local/Cellar/node/8.5.0/bin/node")) 
          .withAppiumJS(new File("/Users/node_modules/appium/build/lib/main.js")) 
          .withLogFile(new File("./AppiumServerlog.txt"))); 
        service.start(); 

       } 

@Test 
public void testStartPage() throws InterruptedException, MalformedURLException { 



DesiredCapabilities cap = new DesiredCapabilities(); 
cap.setCapability("platformName", "iOS"); 
cap.setCapability("platformVersion", "10.3"); 
cap.setCapability("deviceName", "iPhone 7"); 
cap.setCapability("browserName", ""); 
cap.setCapability("app", "/path/to/file"); 
cap.setCapability("noReset", true); 

driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), cap); 


@AfterClass(alwaysRun=true) 
public void tearDown() { 
service.stop(); 
driver.quit(); 


} 

答えて

0

Appiumサーバが起動するまでに数秒を必要としますしたがって、server startコマンドの次の行を遅らせるようにしてください。

driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), cap); 
Thread.sleep(10000); 
関連する問題