• instruments[2623:53437] *** -[__NSCFConstantString stringByAppendingPathExtension:]: cannot append extension 'tracetemplate' to path ''
    Instruments Usage Error: The specified template '' does not exist.
    instruments, version 8.1 (61529)
    usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable
    这是什么原因有遇到过的吗?

  • ava.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:459)
    at java.util.Properties.setProperty(Properties.java:166)
    at org.testng.reporters.JUnitXMLReporter.generateReport(JUnitXMLReporter.java:163)
    at org.testng.reporters.JUnitXMLReporter.onFinish(JUnitXMLReporter.java:118)
    at org.testng.TestRunner.fireEvent(TestRunner.java:1246)
    at org.testng.TestRunner.afterRun(TestRunner.java:1039)
    at org.testng.TestRunner.run(TestRunner.java:621)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
    at org.testng.TestNG.run(TestNG.java:1031)

    请问这个是说报告的地址设置的不对吗

  • 我在 ide 里配置了环境变量问题终于解决了

  • System.out.println(System.getenv().get("ANDROID_HOME"));
    我打印了下是 null。
    明明是配置了的

  • 我用 gui 是好的

  • 用 java 命令启动
    Exception in thread "main" org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find adb Please set the ANDROID_HOME environment variable with the Android SDK root directory path. (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 323 milliseconds
    运行的时候会报这个错误
    我的 bash 如下:
    export MAVEN_HOME=/Users/user/apache-maven-3.3.9
    export M2=$MAVEN_HOME/bin
    export PATH=$M2:$PATH
    export ANDROID_HOME=/Users/user/Library/Android/sdk
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
    export APPIUM_HOME=/Applications/Appium.app/Contents/Resources/node_modules/.bin
    export PATH=${PATH}:${APPIUM_HOME}:${JAVA_HOME}:/Users/user/Library/Android/sdk/platform-tools
    我的 environment.plist 配置如下:
    <?xml version="1.0" encoding="UTF-8"?>
    <! DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">


    Label
    my.startup
    ProgramArguments

    sh
    -c

    launchctl setenv APPIUM_HOME /Applications/Appium.app/Contents/Resources/node_modules/.bin
    launchctl setenv ANDROID_HOME /Users/user/Library/Android/sdk
    launchctl setenv PATH $PATH:/Users/user/Library/Android/sdk/platform-tools


    RunAtLoad



    ~

  • @adfghzhang 非常感谢我用了多线程之后命令是不会阻塞了

  • 不好意思回帖的时候 copy 错了

  • 我把进程杀掉 # lsof -i tcp:4723
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    node 740 user 11u IPv4 0xd766c650ff131c73 0t0 TCP localhost:4723 (LISTEN)
    lijinhaideMacBook-Pro:LaunchAgents root# kill 740
    之后才能打印出下面的信息
    Appium] Welcome to Appium v1.5.3
    [Appium] Non-default server args:
    [Appium] address: '127.0.0.1'
    [Appium] Appium REST http interface listener started on 127.0.0.1:4723

  • <?xml version="1.0" encoding="UTF-8"?>
    <! DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">


    Label
    my.startup
    ProgramArguments

    sh
    -c

    launchctl setenv APPIUM_HOME /Applications/Appium.app/Contents/Resources/node_modules/.bin
    lanchctl setenv ANDROID_HOME /Users/user/Library/Android/sdk
    lanchctl setenv IDEVICEINSTALLER_HOME /usr/local/bin


    RunAtLoad



    加上也是这样

  • export PATH=${PATH}:${APPIUM_HOME}:${JAVA_HOME}:/Users/user/Library/Android/sdk/platform-tools:/usr/local/bin
    我将环境变量加上之后还是会卡 String[] cmds = {"/bin/sh","-c",cmd};
    //Applications/Appium.app/Contents/Resources/node_modules/.bin
    //String[] cmds = {"/bin/sh","-c","/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/main.js appium -a 127.0.0.1 -p 4723"};
    process = Runtime.getRuntime().exec(cmds);
    InputStreamReader reader = new InputStreamReader(process.getErrorStream());
    BufferedReader input1 = new BufferedReader(reader);
    String line1 = "";
    while ((line1 = input1.readLine())!= null)
    {

  • <?xml version="1.0" encoding="UTF-8"?>
    <! DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">


    Label
    my.startup
    ProgramArguments

    sh
    -c

    launchctl setenv APPIUM_HOME /Applications/Appium.app/Contents/Resources/node_modules/.bin
    lanchctl setenv ANDROID_HOME /Users/user/Library/Android/sdk


    RunAtLoad



    这是增加的文件内容,不知道是不是缺啥

  • 我增加了文件 environment.list
    启动还是有错
    /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/.bin/appium -a 127.0.0.1 -p 4723 2>>/Users/user/log.txt
    [Appium] Welcome to Appium v1.5.3
    [Appium] Non-default server args:
    [Appium] address: '127.0.0.1'
    Error: listen EADDRINUSE 127.0.0.1:4723
    at Object.exports.errnoException (util.js:890:11)
    at exports._exceptionWithHostPort (util.js:913:20)
    at Server.
    _dirname.Server.Server._listen2 (net.js:1230:14)
    at listen (net.js:1266:10)
    at net.js:1375:9
    at _combinedTickCallback (internal/process/next_tick.js:77:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

  • lsof -i tcp:4723
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    node 16617 user 11u IPv4 0x242b52c3d89b3d3d 0t0 TCP localhost:4723 (LISTEN)
    看是有 4723 端口的但是不能使用

  • 我的环境变量是这样的
    export MAVEN_HOME=/Users/user/apache-maven-3.3.9
    export M2=$MAVEN_HOME/bin
    export PATH=$M2:$PATH
    export ANDROID_HOME=/Users/user/Library/Android/sdk
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
    export APPIUM_HOME=/Applications/Appium.app/Contents/Resources/node_modules/.bin
    export PATH=${PATH}:${APPIUM_HOME}:${JAVA_HOME}:/Users/user/Library/Android/sdk/platform-tools

    在 mac 终端通过命令行可以正常启动
    但是我用 java 命令行的方式
    命令如下:
    ations/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/.bin/appium -a 127.0.0.1 -p 4723 2>>/Users/user/log.txt
    Process process =null;
    List strList = new ArrayList();
    //String cmd1 = "chmod 777" + "/Users/user/appium.sh";
    String cmdNode = "/Applications/Appium.app/Contents/Resources/node/bin/node ";
    String cmdMain = "/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/main.js ";
    String cmd = cmdNode+APPIUMSERVERSTARTCMD;
    System.out.println(cmd );
    String[] cmds = {"/bin/sh","-c",cmd};
    //Applications/Appium.app/Contents/Resources/node_modules/.bin
    //String[] cmds = {"/bin/sh","-c","/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/main.js appium -a 127.0.0.1 -p 4723"};
    process = Runtime.getRuntime().exec(cmds);
    InputStreamReader reader = new InputStreamReader(process.getErrorStream());
    BufferedReader input1 = new BufferedReader(reader);
    String line1 = "";
    while ((line1 = input1.readLine())!= null)
    {
    到这里就不往下执行了

  • 我用这个在 mac 终端是可以的但是 java String[] cmds = {"/bin/sh","-c","/Applications/Appium.app/Contents/Resources/node_modules/.bin/appium appium -a 127.0.0.1 -p 4723"};
    process = Runtime.getRuntime().exec(cads);
    就无法正常启动

  • 我安装完成 appium 之后 appium.js 和 appium-doctor.js 文件位置跟文中的位置不一样

  • 你是汽车超人的吗

  • 我按照这个步骤修改了但是我的测试报告! 没有显示具体的请求响应信息。请帮助,能帮忙看看吗

  • 写的粗糙了

  • 赞!