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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Wake ~~~ package io.appium.android.bootstrap.handler; import android.os.RemoteException; import com.android.uiautomator.core.UiDevice; import io.appium.android.bootstrap.AndroidCommand; import io.appium.android.bootstrap.AndroidCommandResult; import io.appium.android.bootstrap.CommandHandler; /** * This handler is used to power on the device if it's not currently awake. * */ public class Wake 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) { // only makes sense on a device try { UiDevice.getInstance().wakeUp(); return getSuccessResult(true); } catch (final RemoteException e) { return getErrorResult("Error waking up device"); } } } ~~~ wake事件為喚醒手機,有的時候手機處于睡眠狀態就需要點亮屏幕,如果此時屏幕就是亮的,那么不做任何操作。 # PressBack ~~~ package io.appium.android.bootstrap.handler; import com.android.uiautomator.core.UiDevice; import io.appium.android.bootstrap.AndroidCommand; import io.appium.android.bootstrap.AndroidCommandResult; import io.appium.android.bootstrap.CommandHandler; /** * This handler is used to press back. * */ public class PressBack 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) { UiDevice.getInstance().pressBack(); // Press back returns false even when back was successfully pressed. // Always return true. return getSuccessResult(true); } } ~~~ 在手機上的返回鍵。 # TakeScreenshot ~~~ package io.appium.android.bootstrap.handler; import com.android.uiautomator.core.UiDevice; import io.appium.android.bootstrap.AndroidCommand; import io.appium.android.bootstrap.AndroidCommandResult; import io.appium.android.bootstrap.CommandHandler; import java.io.File; /** * This handler is used to TakeScreenshot. * */ public class TakeScreenshot 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) { final File screenshot = new File("/data/local/tmp/screenshot.png"); try { screenshot.getParentFile().mkdirs(); } catch (final Exception e) { } if (screenshot.exists()) { screenshot.delete(); } UiDevice.getInstance().takeScreenshot(screenshot); return getSuccessResult(screenshot.exists()); } } ~~~ 截屏并將圖片保存在/data/local/tmp路徑下的screenshot.png文件中。 # OpenNotification ~~~ package io.appium.android.bootstrap.handler; import com.android.uiautomator.core.UiDevice; import io.appium.android.bootstrap.AndroidCommand; import io.appium.android.bootstrap.AndroidCommandResult; import io.appium.android.bootstrap.CommandHandler; import static io.appium.android.bootstrap.utils.API.API_18; /** * This handler is used to open the notification shade on the device. * */ public class OpenNotification extends CommandHandler { /* * @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) { // method was only introduced in API Level 18 if (!API_18) { return getErrorResult("Unable to open notifications on device below API level 18"); } // does not make sense on an element if (command.isElementCommand()) { return getErrorResult("Unable to open notifications on an element."); } final UiDevice device = UiDevice.getInstance(); if (device.openNotification()) { return getSuccessResult(true); } else { return getErrorResult("Device failed to open notifications."); } } } ~~~ 打開通知欄操作,api18以后在UiDevice中添加了openNotification()方法,打開通知欄。所以該事件就是去調用該方法
                  <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>

                              哎呀哎呀视频在线观看