测试环境

mac mini OS X Yosemite 10.10.4
appium 1.4.8
Python 2.7.6
xcode 7
ios Simulator iphone 6/ios 8.3

测试功能

app 上传头像

测试步骤

点击上上传按钮,通过” 从相册选取图片 “,选择一张图片,点击” 选取 “按钮。

报错信息

python 窗口报错信息

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command.

appium 窗口报错信息

info: --> POST /wd/hub/session/d29d2a31-7f05-4be9-8b17-b445dbf75ed8/element {"using":"name","sessionId":"d29d2a31-7f05-4be9-8b17-b445dbf75ed8","value":"选取"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: "au.getElementByName('选取')"
info: [debug] Sending command to instruments: au.getElementByName('选取')

info: [debug] Socket data received (38 bytes)

info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":{"ELEMENT":"6"}}
info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"6"},"sessionId":"d29d2a31-7f05-4be9-8b17-b445dbf75ed8"}

info: <-- POST /wd/hub/session/d29d2a31-7f05-4be9-8b17-b445dbf75ed8/element 200 122.543 ms - 87 {"status":0,"value":{"ELEMENT":"6"},"sessionId":"d29d2a31-7f05-4be9-8b17-b445dbf75ed8"}
info: --> POST /wd/hub/session/d29d2a31-7f05-4be9-8b17-b445dbf75ed8/element/6/click {"sessionId":"d29d2a31-7f05-4be9-8b17-b445dbf75ed8","id":"6"}
info: [debug] Pushing command to appium work queue: "au.tapById('6')"
info: [debug] Sending command to instruments: au.tapById('6')
info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: Got new command 18 from instruments: au.getElementByName('选取')
info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: evaluating au.getElementByName('选取')
info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: Lookup returned [object UIAButton] with the name "选取" (id: 6).
info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: responding with:
info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: Running system command #19: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":{"ELEMENT":"6"}}...
info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: Got new command 19 from instruments: au.tapById('6')
info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: evaluating au.tapById('6')
info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: UIAButton.tap()

info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: UIAButton could not be tapped

info: [debug] Socket data received (57 bytes)

info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":13,"value":"elementId 6 could not be tapped"}
info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"elementId 6 could not be tapped"},"sessionId":"d29d2a31-7f05-4be9-8b17-b445dbf75ed8"}

info: <-- POST /wd/hub/session/d29d2a31-7f05-4be9-8b17-b445dbf75ed8/element/6/click 500 382.202 ms - 200 

info: [debug] [INST] 2015-07-29 12:19:23 +0000 Error: VerboseError: elementId 6 could not be tapped

info: [debug] [INST] 2015-07-29 12:19:23 +0000 Error: Error during eval: tapById@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/11FCAD7E-E10F-4D61-A0EB-02690CA3B9F3/bootstrap-4e580d338a12229a.js:1110:25
       eval code
eval@[native code]
startProcessing@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/11FCAD7E-E10F-4D61-A0EB-02690CA3B9F3/bootstrap-4e580d338a12229a.js:2702:30
bootstrap@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/11FCAD7E-E10F-4D61-A0EB-02690CA3B9F3/bootstrap-4e580d338a12229a.js:2770:31
global code@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/11FCAD7E-E10F-4D61-A0EB-02690CA3B9F3/bootstrap-4e580d338a12229a.js:2779:10

info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: responding with:

info: [debug] [INST] 2015-07-29 12:19:23 +0000 Debug: Running system command #20: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":13,"value":"elementId 6 could not be tapped"}...

info: [IOS_SYSLOG_ROW ] Jul 29 20:19:33 --- last message repeated 5 times ---

info: [IOS_SYSLOG_ROW ] Jul 29 20:19:33 kaihejia03deMac-mini.local lsd[52702]: LaunchServices: Currently 0 installed placeholders: (
info: [IOS_SYSLOG_ROW ] )

部分代码

sleep(2)
print driver.page_source
driver.find_element_by_name(u"选取").click()
sleep(1)

页面源码

<?xml version="1.0" encoding="UTF-8"?>
<AppiumAUT>
    <UIAApplication name="天天" label="天天" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0" x="0" y="20" width="375" height="647">
        <UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0" x="0" y="0" width="375" height="667">
            <UIAScrollView name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0" x="0" y="0" width="375" height="667">
                <UIAImage name="照片, 横排, 5:18 PM" label="照片, 横排, 5:18 PM" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0/0" x="0" y="146" width="375" height="375">
                </UIAImage>
            </UIAScrollView>
            <UIAButton name="取消" label="取消" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/1" x="13" y="613.5" width="36" height="34">
            </UIAButton>
            <UIAButton name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/2" x="172.5" y="614" width="30" height="34">
            </UIAButton>
            <UIAButton name="选取" label="选取" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/3" x="326" y="613.5" width="36" height="34">
            </UIAButton>
            <UIAToolbar name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/4" x="0" y="667" width="375" height="44">
                <UIAImage name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/4/0" x="0" y="666.5" width="375" height="0.5">
                </UIAImage>
                <UIAImage name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/4/1" x="0" y="667" width="375" height="44">
                </UIAImage>
            </UIAToolbar>
        </UIAWindow>
        <UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/1" x="0" y="0" width="375" height="667">
        </UIAWindow>
        <UIAWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/2" x="0" y="0" width="375" height="667">
            <UIAStatusBar name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/2/0" x="0" y="0" width="375" height="20">
                <UIAElement name="用三个手指向下轻扫来显现通知中心。, 用三个手指向上轻扫来显现控制中心, 连按两次来滚动到顶部" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="用三个手指向下轻扫来显现通知中心。, 用三个手指向上轻扫来显现控制中心, 连按两次来滚动到顶部" path="/0/2/0/0" x="6" y="0" width="36" height="20">
                </UIAElement>
                <UIAElement name="3 格 Wi-Fi 信号(共 3 格)" label="3 格 Wi-Fi 信号(共 3 格)" value="" dom="" enabled="true" valid="true" visible="true" hint="用三个手指向下轻扫来显现通知中心。, 用三个手指向上轻扫来显现控制中心, 连按两次来滚动到顶部" path="/0/2/0/1" x="47" y="0" width="13" height="20">
                </UIAElement>
                <UIAElement name="8:19 PM" label="8:19 PM" value="" dom="" enabled="true" valid="true" visible="true" hint="用三个手指向下轻扫来显现通知中心。, 用三个手指向上轻扫来显现控制中心, 连按两次来滚动到顶部" path="/0/2/0/2" x="165" y="0" width="45" height="20">
                </UIAElement>
                <UIAElement name="电池电量:100%" label="电池电量:100%" value="" dom="" enabled="true" valid="true" visible="true" hint="用三个手指向下轻扫来显现通知中心。, 用三个手指向上轻扫来显现控制中心, 连按两次来滚动到顶部" path="/0/2/0/3" x="345" y="0" width="25" height="20">
                </UIAElement>
            </UIAStatusBar>
        </UIAWindow>
    </UIAApplication>
</AppiumAUT>

不知道该怎么弄了,错误信息貌似说服务端错误?,求大神。


↙↙↙阅读原文可查看相关链接,并与作者交流