安裝完應用自動開啟(ios)

來源:互聯網
上載者:User
 
通過執行指令碼自動開啟應用,可以使用xcode工具中的instruments來實現。執行命令如下:
<p style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px;"><span class="pln" style="color: rgb(0, 0, 0);">instruments </span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="pln" style="color: rgb(0, 0, 0);">w </span><span class="str" style="color: rgb(0, 136, 0);"><udid></span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="pln" style="color: rgb(0, 0, 0);">t </span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">Applications</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">Xcode</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="pln" style="color: rgb(0, 0, 0);">app</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">Contents</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">Applications</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">Instruments</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="pln" style="color: rgb(0, 0, 0);">app</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">Contents</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">PlugIns</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">AutomationInstrument</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="pln" style="color: rgb(0, 0, 0);">bundle</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">Contents</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">Resources</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="typ" style="color: rgb(102, 0, 102);">Automation</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="pln" style="color: rgb(0, 0, 0);">tracetemplate </span><span class="str" style="color: rgb(0, 136, 0);"><full_path_to_application></span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="pln" style="color: rgb(0, 0, 0);">e UIASCRIPT </span><span class="pun" style="color: rgb(102, 102, 0);"><</span><span class="pln" style="color: rgb(0, 0, 0);">path_to_script</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="pln" style="color: rgb(0, 0, 0);">js</span><span class="pun" style="color: rgb(102, 102, 0);">></span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="pln" style="color: rgb(0, 0, 0);">e UIARESULTSPATH </span><span class="str" style="color: rgb(0, 136, 0);"><output_results_path></span></p>
其中Automation.tracetemplate是UIAutomation的模板檔案,一般在mac裝置中固定路徑。
<full_path_to_application>  應用的appId,需要加雙引號
<path_to_script.js> 執行的測試js指令碼路徑,需要加雙引號
<output_results_path>  測試的輸出路徑,需要加雙引號,可不填

編寫簡單的測試指令碼進行驗證:
<p style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px;"><span class="kwd" style="color: rgb(0, 0, 136);">var</span><span class="pln" style="color: rgb(0, 0, 0);"> target </span><span class="pun" style="color: rgb(102, 102, 0);">=</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="typ" style="color: rgb(102, 0, 102);">UIATarget</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="pln" style="color: rgb(0, 0, 0);">localTarget</span><span class="pun" style="color: rgb(102, 102, 0);">();</span></p><p style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px;"><span class="pln" style="color: rgb(0, 0, 0);">target</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="pln" style="color: rgb(0, 0, 0);">delay</span><span class="pun" style="color: rgb(102, 102, 0);">(</span><span class="lit" style="color: rgb(0, 102, 102);">15</span><span class="pun" style="color: rgb(102, 102, 0);">);</span></p>
執行指令碼的結果是開啟應用15秒後關閉。
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.