package project;
import java.awt.Dimension;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Scanner;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.PerformsTouchActions;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.touch.offset.PointOption;
public class firstpro {static AppiumDriver driver = null;
public static void main(String[] args) {
caps.setCapability(“appPackage”, “com.daraz.android”);
caps.setCapability(“appActivity”, “com.lazada.activities.EnterActivity”);
caps.setCapability(“noReset”, true);
//Set ChromeDriver location
System.setProperty(“webdriver.chrome.driver”,“C:\Computer\PC\Documents\chromedriver_win32\chromedriver.exe”);
//Instantiate Appium Driver
try {
driver = new AndroidDriver(new URL(“http://0.0.0.0:4723/wd/hub”), caps);
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
scrollTo();
}
public static void scrollTo(String direction, int times) throws InterruptedException {
Thread.sleep(1000);
if (direction.equals(“down”)) {
Dimension dim = driver.manage().window().getSize();
int width = dim.getWidth() / 2;
for (int i = 0; i < times; i++) {
int startY = (int) (dim.getHeight() * 0.7);
int endY = (int) (dim.getHeight() * 0.5);
new TouchAction(driver).press(point(width, startY)).waitAction(waitOptions(Duration.ofSeconds(1)))
.moveTo(point(width, endY)).release().perform();
}
}
}
}
THIS IS MY CODE BUT ITS GIVING ERRORS. kindly tell me how to resolve it