<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 如何在遠程設備上執行Shell命令 可以在遠程Android設備或被測模擬器上執行任何命令,并獲取輸出。此操作可能不安全,默認情況下在服務器端已禁用。在啟動服務器時,必須提供命令行參數`--relaxed-security`才能啟用遠程Shell命令執行(以及其他默認禁用的不安全功能)。如果未在服務器端啟用該命令行參數,并且嘗試在客戶端調用`mobile: shell`,則會引發異常。 ### mobile: shell 在被測設備上執行給定的shell命令,并返回其`stdout`或同時返回`stdout`和`stderr`(如果`includeStderr`設置為`true`)。如果命令的返回碼不為0,則將引發異常。該命令的執行動作與其在主機上通過`adb shell`執行的動作相同。 #### 支持的參數 - *command*:遠程命令的名稱。例如,它也可以是可執行文件的完整路徑`/bin/ls`。該參數是強制性的。 - *args*:以字符串數組表示的命令參數列表。如果只提供單個字符串,則它將自動轉換為單項數組。可選參數。 - *includeStderr*:將此參數設置為`true`,以便將`stderr`輸出與`stdout`一起包括到返回的結果中。如果啟用,則返回的結果將map包含相應的字符串鍵 `stdout`和`stder`,否則它只是一個簡單的字符串。默認情況下為`false`。 - *timeout*:shell命令超時時間(以毫秒為單位)。如果該命令需要更多時間來完成執行,則將引發異常。默認為20000毫秒。 #### 用法示例 ```java // Java Map<String, Object> args = new HashMap<>(); args.put("command", "echo"); args.put("args", Lists.newArrayList("arg1", "arg2")); String output = driver.executeScript("mobile: shell", args); assert output.equals("arg1 arg2"); ``` ```python # Python result = driver.execute_script('mobile: shell', { 'command': 'echo', 'args': ['arg1', 'arg2'], 'includeStderr': True, 'timeout': 5000 }) assert result['stdout'] == 'arg1 arg2' ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看