{"id":1600,"date":"2024-04-09T10:10:41","date_gmt":"2024-04-09T02:10:41","guid":{"rendered":"https:\/\/www.gyxwsjdxh.com\/?p=1600"},"modified":"2024-04-09T10:10:41","modified_gmt":"2024-04-09T02:10:41","slug":"%e6%97%b6%e4%b8%8b%e6%9c%80%e7%81%ab%e7%9a%84-airtest-%e5%a6%82%e4%bd%95%e6%b5%8b%e8%af%95%e6%89%8b%e6%9c%ba-app%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.gyxwsjdxh.com\/1600.html","title":{"rendered":"\u65f6\u4e0b\u6700\u706b\u7684 Airtest \u5982\u4f55\u6d4b\u8bd5\u624b\u673a APP\uff1f"},"content":{"rendered":"\n
\n
Airtest \u662f\u7f51\u6613\u51fa\u54c1\u7684\u4e00\u6b3e\u57fa\u4e8e\u56fe\u50cf\u8bc6\u522b\u7684\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\uff0c\u4e3b\u8981\u5e94\u7528\u5728\u624b\u673a APP \u548c\u6e38\u620f\u7684\u6d4b\u8bd5\u3002\u4e00\u65e6\u4f7f\u7528\u4e86\u8fd9\u4e2a\u5de5\u5177\u8fdb\u884c APP \u7684\u81ea\u52a8\u5316\uff0c\u4f60\u5c31\u4f1a\u53d1\u73b0\u81ea\u52a8\u5316\u6d4b\u8bd5\u539f\u6765\u662f\u5982\u6b64\u7b80\u5355\uff01\uff01<\/p>\n
\u8981\u8fdb\u884c APP \u7684\u81ea\u52a8\u5316\u6d4b\u8bd5\uff0c\u9996\u5148\u8981\u5c06\u624b\u673a\u8fde\u4e0a airtest\u3002\u8fde\u63a5\u624b\u673a\u6709\u51e0\u79cd\u65b9\u6cd5\u90fd\u53ef\u4ee5\u5b9e\u73b0\uff1a<\/p>\n
\u6ce8\u610f\uff1a\u90e8\u5206\u624b\u673a\u8fd8\u9700\u8981\u6253\u5f00\u201c\u5141\u8bb8\u6a21\u62df\u4f4d\u7f6e\u201d\u3001\u201c\u5141\u8bb8\u672a\u77e5\u6765\u6e90\u5b89\u88c5\u5e94\u7528\u201d\uff0c\u6240\u4ee5\u5982\u679c\u4e0d\u6210\u529f\u53ef\u4ee5\u628a\u8fd9\u4e24\u4e2a\u9009\u9879\u4e5f\u52fe\u9009\uff01<\/strong>\u2018<\/p>\u5173\u95ed\u7535\u8111\u4e0a\u7684\u624b\u673a\u52a9\u624b\u8f6f\u4ef6\u548c\u8fdb\u7a0b\uff0c\u4f7f\u7528 USB \u7ebf\u8fde\u63a5\u624b\u673a\uff0c\u624b\u673a\u4e0a\u51fa\u73b0\u7684\u201c\u5141\u8bb8 USB \u8c03\u8bd5\u201d\u7684\u5f39\u7a97\uff0c\u70b9\u51fb\u786e\u8ba4\uff1b\u70b9\u51fb airtest \u94fe\u63a5\u9762\u677f\u4e2d\u7684\u201crefresh ADB\u201d\u6309\u94ae\uff0c\u8bbe\u5907\u5217\u8868\u5c06\u4f1a\u5237\u65b0\uff0c\u5e76\u663e\u793a\u51fa\u8be5\u624b\u673a\uff1b\u70b9\u51fb\u5217\u8868\u5185\u5bf9\u5e94\u8bbe\u5907\u7684\u201cconnect\u201d\u6309\u94ae\uff0c\u5373\u53ef\u5b8c\u6210\u8fde\u63a5\u3002 \u5f53\u624b\u673a\u4e0e\u7535\u8111\u5904\u5728\u540c\u4e00\u4e2a wifi \u4e0b\uff0c\u5373\u53ef\u5c1d\u8bd5\u65e0\u7ebf\u8fde\u63a5\u624b\u673a\u4e86\uff0c\u5176\u5b9e\u4e5f\u5c31\u662f\u901a\u8fc7 adb \u65e0\u7ebf\u8fde\u63a5\u624b\u673a\u3002\u4f46\u662f\u8fd9\u79cd\u65b9\u5f0f\u53d7\u9650\u4e8e\u7f51\u7edc\u8fde\u63a5\u7684\u7a33\u5b9a\u6027\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u8fde\u63a5\u4e0d\u591f\u7a33\u5b9a\u7684\u60c5\u51b5\u3002\u5177\u4f53\u8fde\u63a5\u64cd\u4f5c\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\u786e\u4fdd\u624b\u673a\u5f00\u542f\u4e86 USB \u8c03\u8bd5\u9009\u9879\uff0c\u5e76\u5148\u7528 USB \u7ebf\u5c06\u624b\u673a\u548c\u7535\u8111\u8fde\u63a5\u8d77\u6765\u5728\u7535\u8111\u7aef\u6267\u884c\u547d\u4ee4 adb tcpip 5555 \uff0c\u5176\u4e2d 5555 \u662f\u7aef\u53e3\u53f7\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u6765\u6307\u5b9a\uff0c5555 \u662f\u9ed8\u8ba4\u503c\u83b7\u53d6\u624b\u673a\u7684 IP \u5730\u5740\uff0c\u53ef\u4ee5\u5728 \u624b\u673a\u8bbe\u7f6e-\u5173\u4e8e\u624b\u673a-\u72b6\u6001\u4fe1\u606f-IP \u5730\u5740<\/strong> \u91cc\u627e\u5230\uff0c\u4e5f\u53ef\u4ee5\u6267\u884c adb ifconfig \u6765\u67e5\u770b\u968f\u540e\u53ef\u4ee5\u62d4\u6389 USB \u7ebf\uff0c\u5728 AirtestIDE \u7684 \u8fdc\u7a0b\u8bbe\u5907\u8fde\u63a5 \u5904\u8f93\u5165 adb connect \u624b\u673aip:\u521a\u624d\u586b\u5165\u7684\u7aef\u53e3\u53f75555 \uff0c\u70b9\u51fb\u8fde\u63a5\uff0c\u5237\u65b0 ADB \u540e\u5c31\u80fd\u5728\u8bbe\u5907\u5217\u8868\u4e2d\u770b\u5230\u8fde\u4e0a\u7684\u8bbe\u5907\u4e86\u5982\u679c\u56e0\u4e3a\u7f51\u7edc\u6ce2\u52a8\u3001\u91cd\u542f ADB \u7b49\u539f\u56e0\u5bfc\u81f4\u8fde\u63a5\u65ad\u5f00\uff0c\u91cd\u65b0\u6267\u884c\u4e00\u6b21 adb connect ip:port \u5373\u53ef\u3002 1\u3001touch \uff1a\u70b9\u51fb\u64cd\u4f5c<\/strong> \u5305\u542b\u7684\u53c2\u6570\uff1a<\/p>\n v\uff1a\u70b9\u51fb\u7684\u56fe\u7247\u6216\u8005\u5750\u6807<\/p>\n times\uff1a\u70b9\u51fb\u6b21\u6570\uff0c\u9ed8\u8ba4 1 \u6b21<\/p>\n duration\uff1a\u6309\u4f4f\u65f6\u95f4\uff0c\u9ed8\u8ba4 0.01s<\/p>right_click: windows \u6709\u6548 \uff0c\u624b\u673a\u7aef\u65e0\u6548\n 2\u3001text \uff1a\u8f93\u5165\u6587\u672c<\/strong><\/p>\n \u5305\u542b\u7684\u53c2\u6570\uff1a<\/p>\n text\uff1a\u8f93\u5165\u7684\u6587\u672c<\/p>\n enter\uff1a\u5b8c\u6210\u8f93\u5165\u540e\u81ea\u52a8\u6267\u884c enter \u64cd\u4f5c\uff0c\u9ed8\u8ba4\u4e3a True<\/p>search\uff1a\u5b8c\u6210\u8f93\u5165\u540e\u5f3a\u884c\u6267\u884c search \u64cd\u4f5c\uff0c\u9ed8\u8ba4\u4e3a false\n 3\u3001wait\uff1a\u7b49\u5f85\u5143\u7d20\u51fa\u73b0\uff0c\u5982\u679c\u627e\u5230\u8be5\u8fd9\u4e2a \u56fe\u7247\u5c31\u8fd4\u56de\u56fe\u7247\u4e2d\u5fc3\u70b9\u7684\u5750\u6807\uff0c\u5982\u679c\u4e0d\u51fa\u73b0\u5c31\u629b\u51fa\u9519\u8bef\uff1aTargetNotFoundError<\/strong><\/p>\n \u5305\u542b\u7684\u53c2\u6570\uff1a<\/p>\n v\uff1a\u70b9\u51fb\u7684\u56fe\u7247\u6216\u8005\u5750\u6807<\/p>\n timeout\uff1a\u7b49\u5230\u8d85\u65f6\u65f6\u95f4\uff0c\u9ed8\u8ba4 20s<\/p>\n interval\uff1a\u6bcf\u6b21\u5bfb\u627e\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u9ed8\u8ba4 0.5s<\/p>intervalfunc\uff1a\u56fe\u7247\u6ca1\u6709\u627e\u5230\u5c31\u6267\u884c\u540e\u9762\u7684\u51fd\u6570\uff0c\u9ed8\u8ba4\u4e3a None\n 4\u3001sleep \uff1a\u6682\u505c\u7b49\u5f85<\/strong><\/p>\n \u5305\u542b\u7684\u53c2\u6570\uff1a<\/p>secs\uff1a\u5ef6\u8fdf\u65f6\u95f4\uff0c\u9ed8\u8ba4 1.0s\n 5\u3001assert_exist \uff1a \u5224\u65ad\u56fe\u7247\u662f\u5426\u5b58\u5728\uff0c\u5982\u679c\u5b58\u5728\u5c31\u8fd4\u56de\u56fe\u7247\u7684\u4e2d\u5fc3\u5750\u6807\uff0c\u4e0d\u5b58\u5728\u5c31 raise AssertionError<\/strong><\/p>\n \u5305\u542b\u7684\u53c2\u6570\uff1a<\/p>\n v\uff1a\u56fe\u7247<\/p>\n msg\uff1a\u63cf\u8ff0\u6d4b\u8bd5\u70b9\uff0c\u5b83\u5c06\u88ab\u8bb0\u5f55\u5728\u62a5\u544a\u4e2d<\/p>return: \u5b58\u5728\u5c31\u8fd4\u56de\u56fe\u7247\u7684\u4e2d\u5fc3\u5750\u6807\uff0c\u4e0d\u5b58\u5728\u5c31 raise AssertionError\n 6\u3001assert_not_exist \uff1a\u5224\u65ad\u56fe\u7247\u662f\u5426\u4e0d\u5b58\u5728\uff0c\u5982\u679c\u5b58\u5728\u5c31 raise AssertionError<\/strong><\/p>\n \u5305\u542b\u7684\u53c2\u6570\uff1a<\/p>\n v\uff1a\u56fe\u7247<\/p>msg\uff1a\u63cf\u8ff0\u6d4b\u8bd5\u70b9\uff0c\u6d4b\u8bd5 \u62a5\u544a\u4e2d\u663e\u793a\n 7\u3001assert_equal \uff1a \u5224\u65ad\u7b2c\u4e00\u4e2a\u503c\u548c\u7b2c\u4e8c\u4e2a\u503c\u662f\u5426\u76f8\u7b49<\/strong><\/p>\n \u5305\u542b\u7684\u53c2\u6570\uff1a<\/p>\n first\uff1a\u7b2c\u4e00\u4e2a\u5bf9\u6bd4\u6761\u76ee<\/p>\n second\uff1a\u7b2c\u4e8c\u4e2a\u5bf9\u6bd4\u6761\u76ee<\/p>msg\uff1a\u63cf\u8ff0\u6d4b\u8bd5\u70b9\uff0c\u5728\u6d4b\u8bd5\u62a5\u544a\u4e2d\u663e\u793a\n 8\u3001assert_not_equal \uff1a \u5224\u65ad\u7b2c\u4e00\u4e2a\u503c\u548c\u7b2c\u4e8c\u4e2a\u503c\u662f\u5426\u4e0d\u76f8\u7b49<\/strong><\/p>\n \u5305\u542b\u7684\u53c2\u6570\uff1a<\/p>\n first\uff1a\u7b2c\u4e00\u4e2a\u5bf9\u6bd4\u6761\u76ee<\/p>\n second\uff1a\u7b2c\u4e8c\u4e2a\u5bf9\u6bd4\u6761\u76ee<\/p>msg\uff1a\u63cf\u8ff0\u6d4b\u8bd5\u70b9\uff0c\u5728\u6d4b\u8bd5\u62a5\u544a\u4e2d\u663e\u793a\n \u6211\u4eec\u73b0\u5728\u7528\u4ee5\u4e0a\u8fd9\u5199 API \u6765\u5b9e\u73b0\u4e00\u4e2a\u5177\u4f53\u7684\u9700\u6c42\u7528\u4f8b\uff1a<\/p>\n \u9700\u6c42\uff1a \u767b\u5f55\u67e0\u6aac\u73ed app\uff0c\u5e76\u5224\u65ad\u662f\u5426\u767b\u5f55\u6210\u529f\uff1b<\/strong><\/p>\n \u6ce8\u610f\uff1a\u4e3a\u4e86\u786e\u4fdd\u4e07\u65e0\u4e00\u5931\uff0c\u6700\u597d\u5728\u8f93\u5165\u6587\u672c\u4e4b\u524d\uff0c\u5148\u70b9\u51fb\u8f93\u5165\u6846\uff0c\u786e\u8ba4\u8f93\u5165\u7684\u7126\u70b9\u3002<\/strong><\/p>\n \u6240\u4ee5\u5148\u8c03\u7528 touch API\uff0c\u518d\u8c03\u7528 text API\u3002\u70b9\u51fb text API \u5c31\u4f1a\u5f39\u51fa\u5982\u4e0b\u56fe\u6240\u793a\u7684\u6587\u672c\u8f93\u5165\u6846\uff0c\u8f93\u5165\u4f60\u7684\u624b\u673a\u53f7\u7801\u5373\u53ef\u3002\u540c\u6837\u7684\u6b65\u9aa4\uff0c\u8f93\u5165\u5bc6\u7801\uff1b\u6700\u540e\uff0c\u70b9\u51fb\u201c\u767b\u5f55\u201d\u6309\u94ae\u3002<\/p>\n \u7528 assert_exists API \u6765\u65ad\u8a00\u662f\u5426\u767b\u5f55\u7684\u7528\u6237\u540d\u548c\u5934\u50cf\u662f\u6b63\u786e\u7684\uff0c\u811a\u672c\u5982\u4e0b\uff1a<\/p>\n \u53ef\u4ee5\u6253\u5f00\u6d4b\u8bd5\u62a5\u544a\uff0c\u67e5\u770b\u8fd0\u884c\u7ed3\u679c\u548c\u65ad\u8a00\u7684\u56fe\u7247\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n \u5f15\u8a00 Airtest \u662f\u7f51\u6613\u51fa\u54c1\u7684\u4e00\u6b3e\u57fa\u4e8e\u56fe\u50cf\u8bc6\u522b\u7684\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\uff0c\u4e3b\u8981\u5e94\u7528\u5728\u624b\u673a APP \u548c\u6e38\u620f\u7684\u6d4b\u8bd5\u3002\u4e00\u65e6\u4f7f\u7528\u4e86\u8fd9\u4e2a\u5de5\u5177\u8fdb\u884c APP \u7684… <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[19],"tags":[],"class_list":["post-1600","post","type-post","status-publish","format-standard","hentry","category-news"],"_links":{"self":[{"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/posts\/1600"}],"collection":[{"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/comments?post=1600"}],"version-history":[{"count":1,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/posts\/1600\/revisions"}],"predecessor-version":[{"id":1601,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/posts\/1600\/revisions\/1601"}],"wp:attachment":[{"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/media?parent=1600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/categories?post=1600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gyxwsjdxh.com\/wp-json\/wp\/v2\/tags?post=1600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\u7b2c\u4e8c\u79cd\uff1aIP+ \u7aef\u53e3\u7684\u8fde\u63a5\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/h1>\u5df2\u77e5 IP \u548c\u7aef\u53e3\u7684\u8fdc\u7a0b\u8bbe\u5907 ip:port\uff0cAirtestIDE \u53ef\u4ee5\u76f4\u63a5\u8fde\u63a5\uff0c\u70b9\u5f00\u8bbe\u5907\u7a97\u5185\u7684 \u8fdc\u7a0b\u8bbe\u5907\u8fde\u63a5 \u6309\u94ae\u5c06 adb connect ip:port \u5b57\u6bb5\u586b\u5165\u586b\u5145\u6846\u5185\uff0c\u70b9\u51fb \u8fde\u63a5 \u6309\u94ae\uff0c\u8fdc\u7a0b\u8bbe\u5907\u5c06\u51fa\u73b0\u5728\u8bbe\u5907\u5217\u8868\u4e2d\uff0c\u70b9\u51fb connect \u6309\u94ae\u3002
\u7b2c\u4e09\u79cd\uff1a\u65e0\u7ebf\u8fde\u63a5\u3002<\/h1>\n
\u5e38\u7528 API<\/h1>\n
\u5b9e\u6218\u7ec3\u4e60<\/h1>\n
\u6b65\u9aa4\u5982\u4e0b\uff1a<\/h1>\u65b0\u5efa\u4e00\u4e2a air \u811a\u672c\uff0c\u9ed8\u8ba4\u5bfc\u5165\u7684\u6587\u4ef6\u5982\u4e0b\uff1a