<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國際加速解決方案。 廣告
                # UpdateStrings ~~~ package io.appium.android.bootstrap.handler; import io.appium.android.bootstrap.AndroidCommand; import io.appium.android.bootstrap.AndroidCommandResult; import io.appium.android.bootstrap.CommandHandler; import io.appium.android.bootstrap.Logger; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import org.json.JSONObject; /** * This handler is used to update the apk strings. * */ public class UpdateStrings extends CommandHandler { /** * strings.json文件保存的是apk的strings.xml里的內容,在Bootstrap啟動前由appium服務器解析并push到設備端的 * * @return */ public static boolean loadStringsJson() { Logger.debug("Loading json..."); try { final String filePath = "/data/local/tmp/strings.json"; final File jsonFile = new File(filePath); // json will not exist for apks that are only on device // 你的case必須寫明apk的路徑,如果啟動設備上已有的應用而case中沒有app路徑,此時json文件是不存在的 // because the node server can't extract the json from the apk. if (!jsonFile.exists()) { return false; } final DataInputStream dataInput = new DataInputStream( new FileInputStream(jsonFile)); final byte[] jsonBytes = new byte[(int) jsonFile.length()]; dataInput.readFully(jsonBytes); // this closes FileInputStream dataInput.close(); final String jsonString = new String(jsonBytes, "UTF-8"); // 將讀取出來的信息賦給Find類中的屬性,以做后用 Find.apkStrings = new JSONObject(jsonString); Logger.debug("json loading complete."); } catch (final Exception e) { Logger.error("Error loading json: " + e.getMessage()); return false; } return true; } /* * @param command The {@link AndroidCommand} used for this handler. * * @return {@link AndroidCommandResult} * * @see io.appium.android.bootstrap.CommandHandler#execute(io.appium.android. * bootstrap.AndroidCommand) */ @Override public AndroidCommandResult execute(final AndroidCommand command) { if (!loadStringsJson()) { return getErrorResult("Unable to load json file and update strings."); } return getSuccessResult(true); } } ~~~ 在appium初始化的時候,如果你代碼中添加了app應用,而不是啟動手機設備中已經有的應用,這時候appium會將該app解析,并提取出設備當前語言環境的strings.xml文件里的信息保存在strings.json里,并將其push到手機的/data/local/tmp目錄下,當你想要獲取應用中用到的字符串時,手機會去該目錄下讀取strings.json文件并返回給客戶端。 所以上面的代碼也就是我上面說的過程。
                  <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>

                              哎呀哎呀视频在线观看