{"id":128470,"date":"2020-06-23T07:25:21","date_gmt":"2020-06-22T23:25:21","guid":{"rendered":"http:\/\/4563.org\/?p=128470"},"modified":"2020-06-23T07:25:21","modified_gmt":"2020-06-22T23:25:21","slug":"%e6%96%b0%e6%89%8b%e6%90%ad%e5%bb%ba-python-appium-%e7%8e%af%e5%a2%83%e6%97%b6%e9%81%87%e5%88%b0%e7%9a%84%e6%97%a0%e6%b3%95%e6%89%93%e5%bc%80-appium-uiautomator2-server-debug-androidtest-apk","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=128470","title":{"rendered":"\u65b0\u624b\u642d\u5efa Python +Appium \u73af\u5883\u65f6\u9047\u5230\u7684\u65e0\u6cd5\u6253\u5f00 appium-uiautomator2-server-debug-androidTest.apk \u7684\u95ee\u9898\uff0c\u6c42\u5927\u4f6c\u6307\u6559\uff01"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u65b0\u624b\u642d\u5efa Python +Appium \u73af\u5883\u65f6\u9047\u5230\u7684\u65e0\u6cd5\u6253\u5f00 appium-uiautomator2-server-debug-androidTest.apk \u7684\u95ee\u9898\uff0c\u6c42\u5927\u4f6c\u6307\u6559\uff01               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Ctry <\/span>  <span><i><\/i> 80<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h3>\u95ee\u9898\u63cf\u8ff0\uff1a<\/h3>\n<p><strong>Appium \u73af\u5883\u5df2\u7ecf\u642d\u5efa\u6210\u529f\u540e\uff0c\u8fde\u63a5 Android \u771f\u673a\uff0c\u5199\u4e86\u4e00\u4e2a\u6253\u5f00\u624b\u673a Settings \u8fd9\u4e2a\u5e94\u7528\u7684 python \u811a\u672c\u3002\u7136\u540e\u8fd0\u884c\u62a5\u9519\uff0c\u65e0\u6cd5\u6253\u5f00 Settings \u5e94\u7528\u3002\u811a\u672c\u5185\u5bb9\u5982\u4e0b\uff1a<\/strong><\/p>\n<pre><code>from appium import webdriver   desired_caps = {} desired_caps['automationName'] = 'UiAutomator2' desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '6.0' desired_caps['deviceName'] = 'HUAWEI MT7-CL00' desired_caps['udid'] = 'G2W0214922003906'  desired_caps['appPackage'] = 'com.android.settings' desired_caps['appActivity'] = '.HWSettings'  browser = webdriver.Remote('http:\/\/127.0.0.1:4723\/wd\/hub', desired_caps) <\/code><\/pre>\n<h3>\u62a5\u9519\u4fe1\u606f\u5982\u4e0b\uff1a<\/h3>\n<p><strong>Appium \u62a5\u9519\u65e5\u5fd7\uff1a<\/strong> https:\/\/imgur.com\/2TqURdI.jpg<\/p>\n<p><strong>Python \u811a\u672c\u62a5\u9519\u65e5\u5fd7\uff1a<\/strong><\/p>\n<pre><code>Traceback (most recent call last):   File \"E:\/Study\/appauto.py\", line 14, in &lt;module&gt;     browser = webdriver.Remote('http:\/\/127.0.0.1:4723\/wd\/hub', desired_caps)   File \"D:Pythonlibsite-packagesappiumwebdriverwebdriver.py\", line 144, in __init__     proxy   File \"D:Pythonlibsite-packagesseleniumwebdriverremotewebdriver.py\", line 157, in __init__     self.start_session(capabilities, browser_profile)   File \"D:Pythonlibsite-packagesappiumwebdriverwebdriver.py\", line 219, in start_session     response = self.execute(RemoteCommand.NEW_SESSION, parameters)   File \"D:Pythonlibsite-packagesseleniumwebdriverremotewebdriver.py\", line 321, in execute     self.error_handler.check_response(response)   File \"D:Pythonlibsite-packagesseleniumwebdriverremoteerrorhandler.py\", line 242, in check_response     raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: zipAlignApk failed. Original error: Command ''D:\\Android SDK Tools\\build-tools\\29.0.2\\zipalign.exe' -f 4 C:\\Users\\Cww03\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-debug-androidTest.apk C:\\Users\\Cww03\\AppData\\Local\\Temp\\20191111-4600-jdyhkf.bntmh\\appium.tmp' exited with code 1. Stdout: ''; Stderr: 'Unable to open 'C:UsersCww03AppDataRoamingnpmnode_modulesappiumnode_modulesappium-uiautomator2-serverapksappium-uiautomator2-server-debug-androidTest.apk' as zip archive ' <\/code><\/pre>\n<h3>\u73af\u5883\u914d\u7f6e\uff1a<\/h3>\n<p><strong>Appium \u7248\u672c\u53ca\u73af\u5883<\/strong> https:\/\/imgur.com\/wdzzNi7.jpg<\/p>\n<p><strong>Android SDK \u7248\u672c<\/strong> https:\/\/imgur.com\/0KqrAqG.jpg<\/p>\n<p><strong>\u5404\u4f4d\u5927\u4f6c\u4eec\uff0cGoogle \u6ca1\u627e\u5230\u7b54\u6848\u3002\u54ea\u4f4d\u540c\u5b66\u9047\u5230\u8fc7\u76f8\u540c\u76f8\u4f3c\u7684\u95ee\u9898\u7684\uff0c\u80fd\u5426\u6307\u5bfc\u4e00\u4e0b\uff0c\u4e07\u5206\u611f\u8c22\uff01\uff01<\/strong><\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>1<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"44208\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Ctry <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u6ca1\u6709\u5927\u4f6c\u77e5\u9053\u554a\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u65b0\u624b\u642d\u5efa Python +Appi&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/128470"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=128470"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/128470\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=128470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=128470"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=128470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}