Я пытаюсь провести в приложении, и оно вызывает следующую ошибку: org.openqa.selenium.remote.RemoteWebDriver не может быть приведен к org.openqa.selenium.interactions.HasTouchScreen
Пожалуйста, найдите мой Детали кода. вот мой основной класс
public class Yf {
WebDriver driver;
// String path = System.getProperty("user.dir");
WebDriverWait wait;
DesiredCapabilities cap = new DesiredCapabilities();
Swipe swipe = new Swipe(driver);
@BeforeTest
public void initConfig() {
cap.setCapability("deviceName", "R58M439LBRY");
cap.setCapability("platformName", "Android");
// cap.setCapability(CapabilityType.BROWSER_NAME, "Android");
cap.setCapability(CapabilityType.VERSION, "9");
cap.setCapability("appPackage", "com.yellowfinbi.android");
cap.setCapability("appActivity", "md5a479f257bdebd299ec30f02ebca2a5d0.LaunchActivity");
}
@Test
public void Login() throws MalformedURLException, InterruptedException {
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
WebElement SignInButton = driver.findElement(By.xpath("//android.widget.TextView[contains(@text,'Login')]"));
SignInButton.click();
Thread.sleep(2000);
WebElement ServerURL = driver
.findElement(By.xpath("//android.widget.EditText[contains(@text,'Server URL (or address)')]"));
ServerURL.sendKeys("https://chololo.yellowfin.bi/");
Thread.sleep(2000);
WebElement UserName = driver.findElement(By.xpath("//android.widget.EditText[contains(@text,'Username')]"));
UserName.sendKeys("bobby.chodagam@yellowfin.bi");
Thread.sleep(2000);
WebElement PassWord = driver.findElement(By.xpath("//android.widget.EditText[contains(@text,'Password')]"));
PassWord.sendKeys("Sai79baba");
Thread.sleep(2000);
WebElement Login = driver.findElement(By.xpath("//android.widget.TextView[contains(@index,'8')]"));
Login.click();
Thread.sleep(15000);
swipe.Scroll(driver, DIRECTION.LEFT, 1000);
}
}
Пожалуйста, найдите код метода прокрутки ниже
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.interactions.touch.TouchActions;
import org.openqa.selenium.remote.Augmenter;
public class Swipe {
WebDriver driver;
public Swipe(WebDriver driver) {
this.driver = driver;
}
public enum DIRECTION {
DOWN, UP, LEFT, RIGHT;
}
public void Scroll(WebDriver driver, DIRECTION direction, long duration) {
Dimension size = driver.manage().window().getSize();
TouchActions Action = new TouchActions(driver);
int startX = 0;
int endX = 0;
int startY = 0;
int endY = 0;
switch (direction) {
case RIGHT:
startY = (int) (size.height / 2);
startX = (int) (size.width * 0.90);
endX = (int) (size.width * 0.05);
Action.scroll(startX, startY).move(endX, startY).release().perform();
break;
case LEFT:
startY = (int) (size.height / 2);
startX = (int) (size.width * 0.05);
endX = (int) (size.width * 0.90);
Action.scroll(startX, startY).move(endX, startY).release().perform();
break;
case UP:
endY = (int) (size.height * 0.70);
startY = (int) (size.height * 0.30);
startX = (size.width / 2);
Action.scroll(startX, startY).move(endX, startY).release().perform();
break;
case DOWN:
startY = (int) (size.height * 0.70);
endY = (int) (size.height * 0.30);
startX = (size.width / 2);
Action.scroll(startX, startY).move(startX, endY).release().perform();
break;
}
}
}
Пожалуйста, дайте мне знать, что я делаю неправильно. Также вот снимок экрана приложения, которое я пытаюсь провести влево. Спасибо