SwipeWhileNotFound(Direction, Offset, SwipeTime, ElementToFind, Delay, Rounds, Click) notworking

SwipeWhileNotFound not working please help me on this

Hi

I wasn’t able to reproduce your scenario, can you please share some more infroamtion on the way that you are trying to execute? can you also attach any logs that we help us understand your scenario?

https://docs.experitest.com/display/SA/Collect+Support+Data

Hai Tom,

Thanks for your reply. can you please refer below details for my scenario, can you please help me on same,i tried with different xpaths but it is not working, i also tried with keep different offset values also still it is not working .without clicking only test case showing as pass.

app link:https://play.google.com/store/apps/details?id=com.mgmresorts.mgmresorts&hl=en

scenario :Lunch app click on Bookroom link then click on NEW YORK-NEW YORK HOTEL & CASINO
Expected Result: NEW YORK-NEW YORK HOTEL & CASINO should select
Actual Result :NEW YORK-NEW YORK HOTEL & CASINO not selecting because swipewhilenotfound not working

code:
import com.experitest.appium.;
import io.appium.java_client.remote.AndroidMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.SwipeElementDirection;
import org.openqa.selenium.ScreenOrientation;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.By;
import org.junit.
;
import java.net.URL;
import java.net.MalformedURLException;

public class Untitled {
private String host = “localhost”;
private int port = 8889;
private String reportDirectory = “reports”;
private String reportFormat = “xml”;
private String testName = “Untitled”;
protected SeeTestAndroidDriver driver = null;

@Before
public void setUp() throws MalformedURLException {
    DesiredCapabilities dc = new DesiredCapabilities();
    dc.setCapability(SeeTestCapabilityType.REPORT_DIRECTORY, reportDirectory);
    dc.setCapability(SeeTestCapabilityType.REPORT_FORMAT, reportFormat);
    dc.setCapability(SeeTestCapabilityType.TEST_NAME, testName);
    dc.setCapability(MobileCapabilityType.UDID, "MZ5DOVEUZDONSWLZ");
    dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.mgmresorts.mgmresorts");
    dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.mvl.mgmgrand.activities.SplashScreen");
    driver = new SeeTestAndroidDriver<>(new URL("http://"+host+":"+port), dc);
}

@Test
public void testUntitled() {
    driver.findElement(By.xpath("//*[@text='Book Room']")).click();
    driver.sleep(40000);
    driver.swipeWhileNotFound(By.xpath("//android.view.View[@content-desc='NEW YORK-NEW YORK HOTEL & CASINO']"), 0, SwipeElementDirection.DOWN, 2000, 10000, 1, true);
}

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

}

Log:

04:12:39 PM Info Test_Executor Set device to: adb:CP8676_I02

04:12:39 PM Info Test_Executor Device Information
Name: CP8676_I02
S/N: MZ5DOVEUZDONSWLZ
OS: Android
Manufacture: Coolpad
Model: CP8676_I02
Version: 5.1
Screen size: 720x1280
Connected to: 127.0.0.1

04:12:45 PM Info Test_Executor Launch native activity / URL com.mgmresorts.mgmresorts/com.mvl.mgmgrand.activities.SplashScreen

04:12:56 PM Info Test_Executor Set device to: adb:CP8676_I02

04:12:56 PM Info Test_Executor Device Information
Name: CP8676_I02
S/N: MZ5DOVEUZDONSWLZ
OS: Android
Manufacture: Coolpad
Model: CP8676_I02
Version: 5.1
Screen size: 720x1280
Connected to: 127.0.0.1

04:13:02 PM Info Test_Executor Launch native activity / URL com.mgmresorts.mgmresorts/com.mvl.mgmgrand.activities.SplashScreen

04:13:07 PM Info Test_Executor Click ‘xpath=//*[@text=‘Book Room’]’ in zone NATIVE, index: 0, click count: 1

04:13:48 PM Info Test_Executor Sleep for: 40000 milliseconds

04:13:49 PM Info Test_Executor Swipe to find xpath=//android.view.View[@content-desc=‘NEW YORK-NEW YORK HOTEL & CASINO’]

04:13:49 PM Info Test_Executor Found: true

Hi Tom,

I am using Appium studio enterprise license to test mobile web app. I am too facing issue while using “SwipeWhileNotFound” function in my java based selenium framework. Inline is the command exported from Appium studio and used in my framework but somehow it didn’t worked.

(driver.executeScript(“client:client.swipeWhileNotFound(“Down”, 0, 2000, “xpath=//*[@text=‘Clear’]”, 1000, 5, false)”);

Hi,
You are right, there is a bug with the code export piece which is fixed in the upcoming version

please add the CONTEXT of your element as the below example : (for native context)

(driver.executeScript("client:client.swipeWhileNotFound(\"Down\", 0, 2000,\"NATIVE\", \"xpath=//*[@text='Clear']\", 1000, 5, false)");