<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>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # setText ~~~ package io.appium.android.bootstrap.handler; import com.android.uiautomator.core.UiDevice; import com.android.uiautomator.core.UiObjectNotFoundException; import io.appium.android.bootstrap.*; import org.json.JSONException; import java.util.Hashtable; /** * This handler is used to set text in elements that support it. * */ public class SetText extends CommandHandler { /* * @param command The {@link AndroidCommand} used for this handler. * * @return {@link AndroidCommandResult} * * @throws JSONException * * @see io.appium.android.bootstrap.CommandHandler#execute(io.appium.android. * bootstrap.AndroidCommand) */ @Override public AndroidCommandResult execute(final AndroidCommand command) throws JSONException { if (command.isElementCommand()) { // Only makes sense on an element try { final Hashtable<String, Object> params = command.params(); final AndroidElement el = command.getElement(); String text = params.get("text").toString(); Boolean pressEnter = false; if (text.endsWith("\\n")) { pressEnter = true; text = text.replace("\\n", ""); Logger.debug("Will press enter after setting text"); } final Boolean result = el.setText(text); if (pressEnter) { final UiDevice d = UiDevice.getInstance(); d.pressEnter(); } return getSuccessResult(result); } catch (final UiObjectNotFoundException e) { return new AndroidCommandResult(WDStatus.NO_SUCH_ELEMENT, e.getMessage()); } catch (final Exception e) { // handle NullPointerException return getErrorResult("Unknown error"); } } else { return getErrorResult("Unable to set text without an element."); } } } ~~~ 寫了這么多篇啦,上面的前幾行代碼都熟悉都不能再熟悉了,就不像第一篇文章那樣一一介紹了,setText方法就是在可編輯都文本框中輸入數據,所以也沒什么特殊地方,無非就是調用UiObject的setText方法,不過仔細看看會發現,它做了一些處理,比如字符串的換行符刪掉,輸入完畢以后按一下enter鍵完成輸入。那么我之前寫case的時候這些也需要自己做,因為如果不按enter鍵的話,有些輸入法是會出一些問題的,比如漢語它是先出你輸入的字符代表的漢字然后你按enter它才會正確的顯示在文本框里的,不象英文輸入法直接在輸入框里。所以appium考慮到里這些已經幫我們處理啦。 # getText 沒什么可說到,就是簡單到調用了UiObject的getText方法獲取編輯框里的數據。
                  <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>

                              哎呀哎呀视频在线观看