在appium中启动iOS设备时出错

时间:2017-02-01 10:23:02

标签: appium

我有Xcode 8.2版本。我在eclipse中编写代码并尝试运行。我能够安装ipa文件,但在尝试打开应用程序时,它没有打开。请在下面找到我的代码 -

setTimeout(this.CheckGameOver, (5 * 1000)); 

请在下面找到appium控制台日志 -

package com.sampleiOS.com.sampleiOS;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;

//import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;




/**
 * Unit test for simple App.
 */
public class AppTest 
{
    //public WebDriver driver;
    public AppiumDriver<MobileElement> driver;
    /**
     * @return 
     * @return 
     * @return the suite of tests being tested
     * @throws MalformedURLException 
     * @throws InterruptedException 
     */
    @Test
    public void Rijo() throws MalformedURLException, InterruptedException
    {

        AppiumDriverLocalService service = AppiumDriverLocalService
                .buildService(new AppiumServiceBuilder()
                        .usingDriverExecutable(new File("/usr/local/opt/node/bin/node"))
                        .withAppiumJS(new File(
                                "/usr/local/lib/node_modules/appium/build/lib/main.js")));
                        //.withLogFile(new File("AppiumServerLogs/logs.txt")));
        service.start();
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Ipod");
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.3");
        capabilities.setCapability(MobileCapabilityType.UDID, "4319165xxxxx");
       capabilities.setCapability("app", "/Users/rijom/Downloads/xx.ipa");
        capabilities.setCapability("automationName", "XCUITest");

        driver = new IOSDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
        Thread.sleep(5000);

    }
}

我已经使用我的应用程序团队和证书更新了WebDriverAgentLib,然后创建了一个新的应用程序作为webDriverAgent,但没有打开我的应用程序。你能帮我看看如何打开应用程序吗?

2 个答案:

答案 0 :(得分:0)

如果存在流氓iproxy会话,您可以通过执行

来终止它
ps -ax|grep -i "iproxy"|grep -v grep|awk '{print "kill -9 " $1}'|sh

在命令行上。

答案 1 :(得分:0)

iProxy没有退出,找到端口并杀死它。 查找端口:

lsof -i -n -P | grep 8100

要杀死:

kill -9 PORT_NUMBER

将其复制到终端

export USE_PORT=8100

对于真实设备,请重新连接iOS电缆并尝试运行代码。