• 谢谢老师,我以后会关注社区的

  • 老师您好,我这边用 Appium(1.4.8)+macos(10.11)一直都可以进行自动化测试,但是前段时间 mac 升级了系统 10.12.4,然后就不能用了,点击 Inspector 就提示
    而且手机还会弹是否信任的弹窗,log 如下:

    info: --> GET /wd/hub/sessions {}
    info: [debug] Responding to client with success: {"status":0,"value":[]}
    info: <-- GET /wd/hub/sessions 200 0.853 ms - 23 {"status":0,"value":[]}
    info: --> POST /wd/hub/session {"desiredCapabilities":{"platformName":"iOS","platformVersion":"10.3","newCommandTimeout":"999999","automationName":"Appium","deviceName":"iPhone 6 Plus"}}
    info: Client User-Agent string: Appium (unknown version) CFNetwork/811.4.18 Darwin/16.5.0 (x86_64)
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: ****        NEW SESSION           ***
    info: ****        NEW SESSION           ***
    info: ****        NEW SESSION           ***
    info: ****        NEW SESSION           ***
    info: ****        NEW SESSION           ***
    info: ****        NEW SESSION           ***
    info: ****        NEW SESSION           ***
    info: ****        NEW SESSION           ***
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: *************************************
    info: [debug] App is an iOS bundle, will attempt to run as pre-existing
    info: [debug] Creating new appium session 6f759b3a-bb06-4a65-babe-14d82a26d843
    info: [debug] Removing any remaining instruments sockets
    info: [debug] Cleaned up instruments socket /tmp/instruments_sock
    info: [debug] Auto-detecting iOS udid...
    info: [debug] Not auto-detecting udid, running on sim
    info: [debug] Could not parse plist file (as binary) at /Applications/Appium.app/Contents/Resources/node_modules/appium/pearvideo.livideo.video/en.lproj/Localizable.strings
    info: Will try to parse the plist file as XML
    info: [debug] Could not parse plist file (as XML) at /Applications/Appium.app/Contents/Resources/node_modules/appium/pearvideo.livideo.video/en.lproj/Localizable.strings
    warn: Could not parse app Localizable.strings assuming it doesn't exist
    info: [debug] Creating instruments
    info: [debug] Preparing uiauto bootstrap
    info: [debug] Dynamic bootstrap dir: /Users/hujunyi/Library/Application Support/appium/bootstrap
    info: [debug] Dynamic env: {"nodePath":"/Applications/Appium.app/Contents/Resources/node/bin/node","commandProxyClientPath":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js","instrumentsSock":"/tmp/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"grouped"}
    
    info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
    ...
    info: [debug] Dynamic bootstrap path: /Users/hujunyi/Library/Application Support/appium/bootstrap/bootstrap-6745615c424bb0c0.js
    info: [debug] Reusing dynamic bootstrap: /Users/hujunyi/Library/Application Support/appium/bootstrap/bootstrap-6745615c424bb0c0.js
    info: [debug] Attempting iOS device log capture via libimobiledevice idevicesyslog
    
    info: [debug] Creating iDevice object with udid 9a5b0963e6bdc020ebcc6775976a18edc45c5df6
    
    info: [debug] App is not installed. Will try to install the app.
    
    info: [debug] Cleaning up appium session
    
    error: Failed to start an Appium session, err was: Error: Installing pearvideo.livideo.video failed
    
    info: [debug] Error: Installing pearvideo.livideo.video failed
        at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/node-idevice/main.js:159:6
        at ChildProcess.exithandler (child_process.js:742:7)
        at ChildProcess.emit (events.js:110:17)
        at maybeClose (child_process.js:1015:16)
        at Socket.<anonymous> (child_process.js:1183:11)
        at Socket.emit (events.js:107:17)
        at Pipe.close (net.js:485:12)
    
    info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Installing pearvideo.livideo.video failed)","origValue":"Installing pearvideo.livideo.video failed"},"sessionId":null}
    info: <-- POST /wd/hub/session 500 1504.148 ms - 204
    

    还有就是我的 ANDROID 仍然是可以跑的,点击 doctor 也是全部通过的,deviceconsole 也是有的,ideviceinstall 也安装,但是有如下提示:

    hujunyideMacBook-Pro:~ hujunyi$ brew install ideviceinstaller
    Warning: ideviceinstaller-1.1.0_2 already installed
    Warning: You are using OS X 10.12.
    We do not provide support for this pre-release version.
    You may encounter build failures or other breakages.
    Please create pull-requests instead of filing issues.
    

    Appium 的配置如下:

    希望能指导一下,万分感谢!

  • #2 楼 @qumoy 返回键不需要焦点呀,直接点返回键就行了呀,坐标你就获取旁边的坐标值呗,你用什么语言写得

  • 点下返回键可以返回吗?要不行就随便点个坐标点

  • #1 楼 @neven7
    我按照你说的该成下面这样:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!-- WARNING: Eclipse auto-generated file.
                  Any modifications will be overwritten.
                  To include a user specific buildfile here, simply create one in the same
                  directory with the processing instruction <?eclipse.ant.import?>
                  as the first entry and export the buildfile again. --><project basedir="." default="build" name="pearVideo_Demo">
        <property environment="env"/>
        <property name="junit.output.dir" value="junit"/>
        <property name="time" value="${NOW}" />
        <property name="debuglevel" value="source,lines,vars"/>
        <property name="target" value="1.8"/>
        <property name="source" value="1.8"/>
        <path id="pearVideo_Demo.classpath">
            <pathelement location="bin"/>
            <pathelement location="../../导入包/java-client-1.6.0.jar"/>
            <pathelement location="../../导入包/selenium-java-2.44.0.zip"/>
            <pathelement location="../../导入包/selenium-server-standalone-2.44.0.jar"/>
        </path>
        <target name="init">
            <mkdir dir="bin"/>
            <copy includeemptydirs="false" todir="bin">
                <fileset dir="src">
                    <exclude name="**/*.launch"/>
                    <exclude name="**/*.java"/>
                </fileset>
            </copy>
        </target>
        <target name="clean">
            <delete dir="bin"/>
        </target>
        <target depends="clean" name="cleanall"/>
        <target depends="build-subprojects,build-project" name="build"/>
        <target name="build-subprojects"/>
        <target depends="init" name="build-project">
            <echo message="${ant.project.name}: ${ant.file}"/>
            <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
                <src path="src"/>
                <classpath refid="pearVideo_Demo.classpath"/>
            </javac>
        </target>
        <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
        <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
            <copy todir="${ant.library.dir}">
                <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
            </copy>
            <unzip dest="${ant.library.dir}">
                <patternset includes="jdtCompilerAdapter.jar"/>
                <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
            </unzip>
        </target>
        <target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
            <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
            <antcall target="build"/>
        </target>
        <target name="Android_0603">
            <mkdir dir="${junit.output.dir}"/>
            <junit fork="yes" printsummary="withOutAndErr">
                <batchtest todir="${junit.output.dir}/${time}">
                <fileset dir="${build.dest}">
                <include name="**/*TestSuite.class" />
                </fileset>
                </batchtest>
                <formatter type="xml"/>
                <test name="pearVideo_Demo_Android.Android_0603" todir="${junit.output.dir}/${time}"/>
                <classpath refid="pearVideo_Demo.classpath"/>
            </junit>
        </target>
        <target name="junitreport">
            <junitreport todir="${junit.output.dir}">
            <fileset dir="${junit.output.dir}/${time}">
            <include name="TEST-*.xml" />
            </fileset>
            <report format="noframes" todir="${{junit.output.dir}}/${time}" />
            </junitreport>
        </target>
    </project>
    
    

    跑出后报告内容显示为 0 ,


    新创建的 ${NOW}文件中也有本次测试的数据,不知道为什么报告里面显示 0 。
    junit-noframes.html 和 index.xml 都没有测试结果,帮忙再看下,是不是我写错什么了,谢谢!

  • 我生成的 junit 测试报告显示的是上一次的测试数据
    build.xml 如下:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!-- WARNING: Eclipse auto-generated file.
                  Any modifications will be overwritten.
                  To include a user specific buildfile here, simply create one in the same
                  directory with the processing instruction <?eclipse.ant.import?>
                  as the first entry and export the buildfile again. --><project basedir="." default="build" name="pearVideo_Demo">
        <property environment="env"/>
        <property name="junit.output.dir" value="junit"/>
        <property name="debuglevel" value="source,lines,vars"/>
        <property name="target" value="1.8"/>
        <property name="source" value="1.8"/>
        <path id="pearVideo_Demo.classpath">
            <pathelement location="bin"/>
            <pathelement location="../../导入包/java-client-1.6.0.jar"/>
            <pathelement location="../../导入包/selenium-java-2.44.0.zip"/>
            <pathelement location="../../导入包/selenium-server-standalone-2.44.0.jar"/>
        </path>
        <target name="init">
            <mkdir dir="bin"/>
            <copy includeemptydirs="false" todir="bin">
                <fileset dir="src">
                    <exclude name="**/*.launch"/>
                    <exclude name="**/*.java"/>
                </fileset>
            </copy>
        </target>
        <target name="clean">
            <delete dir="bin"/>
        </target>
        <target depends="clean" name="cleanall"/>
        <target depends="build-subprojects,build-project" name="build"/>
        <target name="build-subprojects"/>
        <target depends="init" name="build-project">
            <echo message="${ant.project.name}: ${ant.file}"/>
            <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
                <src path="src"/>
                <classpath refid="pearVideo_Demo.classpath"/>
            </javac>
        </target>
        <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
        <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
            <copy todir="${ant.library.dir}">
                <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
            </copy>
            <unzip dest="${ant.library.dir}">
                <patternset includes="jdtCompilerAdapter.jar"/>
                <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
            </unzip>
        </target>
        <target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
            <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
            <antcall target="build"/>
        </target>
        <target name="Android_0603">
            <mkdir dir="${junit.output.dir}"/>
            <junit fork="yes" printsummary="withOutAndErr">
                <formatter type="xml"/>
                <test name="pearVideo_Demo_Android.Android_0603" todir="${junit.output.dir}"/>
                <classpath refid="pearVideo_Demo.classpath"/>
            </junit>
        </target>
        <target name="junitreport">
            <junitreport todir="${junit.output.dir}">
                <fileset dir="${junit.output.dir}">
                    <include name="TEST-*.xml"/>
                </fileset>
                <report format="frames" todir="${junit.output.dir}"/>
            </junitreport>
        </target>
    </project>
    

    但是我的 junit 文件夹会生成两个.xml 文件,如下:

    每次测试数据会保存在第一个文件里,但是生成的测试报告拿的是第二个文件的数据(进行测试的时候,第二个文件会继承第一个文件的数据)所以每次生成的报告都会是上一次的测试结果。能不能帮忙看看,谢谢!
    我尝试修改成

    </target>
    <target name="junitreport">
        <junitreport todir="${junit.output.dir}">
            <fileset dir="${junit.output.dir}">
                <include name="TESTS-*.xml"/>
            </fileset>
            <report format="frames" todir="${junit.output.dir}"/>
        </junitreport>
    </target>
    

    运行提示 TESTS-TestSuites.xml 不是测试套件.....

  • #1 楼 @monkey 好的,受教了

  • #1 楼 @codeskyblue
    谢谢,最近有点忙。除了方法一没试,方法二,三都没有安装成功....
    方法二提示如下:

    Error: No available formula with the name "imobiledevice" 
    ==> Searching for similarly named formulae...
    This similarly named formula was found:
    libimobiledevice 
    To install it, run:
      brew install libimobiledevice 
    ==> Searching taps...
    Error: No formulae found in taps.
    

    方法三提示如下:

    npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
    /usr/local/lib
    └── ios-deploy@1.8.6 
    
    npm ERR! Darwin 15.4.0
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ios-deploy"
    npm ERR! node v5.11.0
    npm ERR! npm  v3.8.6
    npm ERR! path /usr/local/lib/node_modules
    npm ERR! code EACCES
    npm ERR! errno -13
    npm ERR! syscall access
    
    npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
    npm ERR!     at Error (native)
    npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'access',
    npm ERR!   path: '/usr/local/lib/node_modules' }
    npm ERR! 
    npm ERR! Please try running this command again as root/Administrator.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /Users/hujunyi/npm-debug.log
    

    顺便问一下:通过 Appium 能够实现自动安装吗?

  • 楼主,这个 appium 的测试框架搭建好了吗?我也想搭建个,但是我只懂一点,目前公司用的禅道,Appium(还没实现 jenkins 自动驱动 Appium 实现自动化测试)。能不能分享下经验,谢谢

  • #13 楼 @debugtalk 自动安装到真机上是不是就是把签过名的.ipa 的路径放到这里面 capabilities.setCapability("app", “............”);就行了?为什么安装还是报错,帮忙讲解下,谢谢