以下代码用于启动驱动程序,
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("platformName", "Android");
cap.setCapability("deviceName", "emulator-5554");
cap.setCapability("platformVersion", "12");
cap.setCapability("automationName", "UIAutomator2");
cap.setCapability("appPackage","com.android.settings");
cap.setCapability("appActivity",".Settings");
String appuimURL = "http://127.0.0.1:4723/";
driver = new AppiumDriver(new URL(appuimURL), cap);
SetUp.setDriver(driver);
我尝试了各种代码来滚动未出现在视口中的元素,但没有任何效果。我正在 SetUp.setDriver() 方法中将此 appiumdriver 分配给 WebElement 的更多信息。
对于安卓: driver.findElements(AppiumBy.androidUIAutomator("new UiScrollable(new UiSelector())).scrollIntoView(text("Google"));"));