...7import org.junit.After;8import org.junit.Before;9import org.junit.Test;10import org.openqa.selenium.WebElement;11import org.openqa.selenium.interactions.Interaction;12import org.openqa.selenium.interactions.PointerInput;13import org.openqa.selenium.interactions.PointerInput.Kind;14import org.openqa.selenium.interactions.PointerInput.MouseButton;15import org.openqa.selenium.interactions.PointerInput.Origin;16import org.openqa.selenium.interactions.Sequence;17import org.openqa.selenium.remote.DesiredCapabilities;18import org.openqa.selenium.support.ui.ExpectedConditions;19import org.openqa.selenium.support.ui.WebDriverWait;20public class Ch_05_03_Touch_Actions_After {21 private static final String APP = "https://github.com/cloudgrey-io/the-app/releases/download/v1.9.0/TheApp-v1.9.0.apk";22 private static final String APPIUM = "http://localhost:4723/wd/hub";23 private AndroidDriver driver;24 @Before25 public void setUp() throws Exception {26 DesiredCapabilities caps = new DesiredCapabilities();27 caps.setCapability("platformName", "Android");28 caps.setCapability("platformVersion", "9");29 caps.setCapability("deviceName", "Android Emulator");30 caps.setCapability("automationName", "UiAutomator2");31 caps.setCapability("app", APP);32 driver = new AndroidDriver(new URL(APPIUM), caps);33 }34 @After35 public void tearDown() {36 if (driver != null) {37 driver.quit();38 }39 }40 @Test41 public void test() {42 WebDriverWait wait = new WebDriverWait(driver, 10);43 WebElement screen = wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("List Demo")));44 screen.click();45 wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("Altocumulus")));46 PointerInput finger = new PointerInput(Kind.TOUCH, "finger");47 Interaction moveToStart = finger.createPointerMove(Duration.ZERO, Origin.viewport(), 520, 1530);48 Interaction pressDown = finger.createPointerDown(MouseButton.LEFT.asArg());49 Interaction moveToEnd = finger.createPointerMove(Duration.ofMillis(1000), Origin.viewport(), 520, 490);50 Interaction pressUp = finger.createPointerUp(MouseButton.LEFT.asArg());51 Sequence swipe = new Sequence(finger, 0);52 swipe.addAction(moveToStart);53 swipe.addAction(pressDown);54 swipe.addAction(moveToEnd);55 swipe.addAction(pressUp);56 driver.perform(Arrays.asList(swipe));57 driver.findElement(MobileBy.AccessibilityId("Stratus"));58 }59}...