SwipeElementDirection cannot be resolved

Hello, good morning

Im trying to use driver.swipe but this line (import io.appium.java_client.SwipeElementDirection;
) in eclipse say : " The import io.appium.java_client.SwipeElementDirection cannot be resolved:"

and in the test code I write: driver.swipe(349, 867, 290, 303, 507); and say: The method swipe(int, int, int, int, int) is undefined for the type IOSDriver

What is happening? when I run the code in appium studio works well, but not in Eclipse

package tests;

//package ;
import io.appium.java_client.remote.IOSMobileCapabilityType;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.SwipeElementDirection;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.By;
import org.testng.annotations.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.logging.Level;

public class Untitled {
private String reportDirectory = “reports”;
private String reportFormat = “xml”;
private String testName = “Untitled”;
protected IOSDriver driver = null;

DesiredCapabilities dc = new DesiredCapabilities();

@BeforeMethod
public void setUp() throws MalformedURLException {
dc.setCapability(“reportDirectory”, reportDirectory);
dc.setCapability(“reportFormat”, reportFormat);
dc.setCapability(“testName”, testName);
dc.setCapability(MobileCapabilityType.UDID, “E4F6EDC4-E23C-42B3-987D-3DB282CA77C1”);
dc.setCapability(IOSMobileCapabilityType.BUNDLE_ID, “com.test.beta.test.testapps”);
driver = new IOSDriver<>(new URL(“http://localhost:4723/wd/hub”), dc);
driver.setLogLevel(Level.INFO);
}

@Test
public void testUntitled() {
driver.findElement(By.xpath(“//[@text=‘3’]“)).click();
driver.findElement(By.xpath(”//
[@accessibilityLabel=‘cart_startShoppingButton’]”)).click();
driver.findElement(By.xpath(“//[@text=‘Te llegará entre el jueves 3 y el viernes 4 noviembre’ and ./parent::[@text=‘shippingMethodCell_CurrentStore’]]”)).click();
driver.findElement(By.xpath(“//[@text=‘SANT CUGAT’]“)).click();
driver.findElement(By.xpath(”//
[@text=‘Pago con tarjeta’]”)).click();
driver.findElement(By.xpath(“//[@accessibilityLabel=‘payment_cardNumberField’]“)).sendKeys(“4111111111111111”);
driver.swipe(349, 867, 290, 303, 507);
driver.findElement(By.xpath(”//
[@accessibilityLabel=‘payment_cvvField’]”)).sendKeys(“123”);
}

@AfterMethod
public void tearDown() {
driver.quit();
}
}

If the code runs in one IDE, but not the other then it’s probably an IDE issue. If you don’t get an answer here, Eclipse has a discussion board:

1 Like

I check too in IntelliJ CE and neither, so maybe Im missing some import or something? thank you