-1

I have a problem with scrolling in mobile Native App, I am using : Java as language Java Client 1.7.0 appium node 1.13.0 OS version Android AND Appium Driver

and trying to scroll after enter the page "Profile", but some How the app crashes.

enter image description here

I am using the following Methode for scrolling:

public void scrollDown() {
    Dimension dimension = driver.manage().window().getSize();
    // System.out.println("Dimension value = "+dimension);

    Double scrollHeightStart = dimension.getHeight() * 0.5;
    int scrollStart = scrollHeightStart.intValue();
    // System.out.println("Screen Height start Value="+scrollHeightStart);

    Double scrollHeightEnd = dimension.getHeight() * 0.2;
    int scrollEnd = scrollHeightEnd.intValue();
    // System.out.println("Scroll Start Value="+scrollHeightEnd);

    TouchAction touch = new TouchAction((PerformsTouchActions) driver);
    touch.press(PointOption.point(0, scrollStart))
            .waitAction(WaitOptions.waitOptions(Duration.ofSeconds(1)))
            .moveTo(PointOption.point(0, scrollEnd))
            .release()
            .perform();
}

but after run the script by calling the Scroll Method get the following in Log :

..........
.......
    Juni 22, 2019 3:31:18 VORM. utilities.Helper startAppiumServer
    INFO: utilities.Helper§§§§§§§§§§§§§§§§§§§§§§§ Start Appium Server §§§§§§§§§§§§§§§§§§§§§§§§§
    startAppiumServer: Before Test done
    [HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
    Fatal Error: listen EADDRINUSE: address already in use 127.0.0.1:4723
        at Server.setupListenHandle [as _listen2] (net.js:1270:14)
        at listenInCluster (net.js:1318:12)
        at doListen (net.js:1451:7)
        at process._tickCallback (internal/process/next_tick.js:63:19)
    Juni 22, 2019 3:31:31 VORM. io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
    INFO: Detected dialect: W3C
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/C:/Users/khazinehdarllo/.m2/repository/cglib/cglib/3.2.8/cglib-3.2.8.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
    WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    Juni 22, 2019 3:31:31 VORM. utilities.Helper getmMthodName
    INFO: utilities.Helper +++++++++++++++++++++ Start of Test Execution: Test Case TC_1296_ForgotPassword_FromChangePasswordScreen +++++++++++++++++++++++++++
    Juni 22, 2019 3:31:37 VORM. screens.Welcome_Screen click_Login_Button
    INFO: screens.Welcome_ScreenWELCOME Screen: Login Button clicked successfully (OK)
    Juni 22, 2019 3:31:47 VORM. screens.Login_Screen enter_Valid_Email
    INFO: screens.Login_ScreenREGISTRATION Screen: Email Field entered successfully (OK)
    Juni 22, 2019 3:31:53 VORM. screens.Login_Screen enter_Valid_Password
    INFO: screens.Login_ScreenREGISTRATION Screen: Password Field entered successfully (OK)
    Juni 22, 2019 3:31:54 VORM. screens.Login_Screen select_remainLoggedIn_CheckBox
    INFO: screens.Login_ScreenLOGIN Screen : RemainLoggedIn Checkbox selected successfully (OK)
    Juni 22, 2019 3:31:55 VORM. screens.Login_Screen click_Login_Button
    INFO: screens.Login_ScreenLOGIN Screen : Login Button clicked successfully (OK)
    Juni 22, 2019 3:31:58 VORM. screens.SelectCity_Screen select_X
    INFO: screens.SelectCity_ScreenSELECT CITY Screen : City X clicked successfully (OK)
    Juni 22, 2019 3:32:01 VORM. screens.CommonObjects_InAll_Screen click_Profile_Icon
    INFO: screens.CommonObjects_InAll_ScreenCOMMON OBJECT Profile Icon : Profile Icon clicked successfully (OK)

    java.lang.NullPointerException
        at utilities.PageActions.scrollDown(PageActions.java:308)
        at testScripts.login.errorHandling.Login_ErrorHandling_No_FTU_Tests.TC_1296_ForgotPassword_FromChangePasswordScreen(Login_ErrorHandling_No_FTU_Tests.java:119)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
        at org.testng.TestRunner.privateRun(TestRunner.java:648)
        at org.testng.TestRunner.run(TestRunner.java:505)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
        at org.testng.SuiteRunner.run(SuiteRunner.java:364)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
        at org.testng.TestNG.runSuites(TestNG.java:1049)
        at org.testng.TestNG.run(TestNG.java:1017)
        at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73)
        at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)


    Juni 22, 2019 3:32:01 VORM. testScripts.BasicSetup stopApp
    INFO: testScripts.BasicSetupDestroying Test Environment
    Juni 22, 2019 3:32:01 VORM. testScripts.BasicSetup stopApp
    INFO: testScripts.BasicSetupStop App
    Juni 22, 2019 3:32:01 VORM. testScripts.BasicSetup stopApp
    INFO: testScripts.BasicSetup ===================== End of Test Execution ===========================

    ===============================================
    Default Suite
    Total tests run: 1, Failures: 1, Skips: 0
    ===============================================

    Juni 22, 2019 3:32:02 VORM. testScripts.login.errorHandling.Login_ErrorHandling_No_FTU_Tests stopAppiumServer
    INFO: testScripts.login.errorHandling.Login_ErrorHandling_No_FTU_TestsStop Appium Server
    Juni 22, 2019 3:32:02 VORM. testScripts.login.errorHandling.Login_ErrorHandling_No_FTU_Tests stopAppiumServer
    INFO: testScripts.login.errorHandling.Login_ErrorHandling_No_FTU_Tests===============================================

and .PageActions.scrollDown(PageActions.java:308) is in code in methode scrollDown:

Dimension dimension = driver.manage().window().getSize();

My assumption is that the scroll view does not start from beginning of page so i have first to switch to scroll view layout then I can scroll

I have the same View in Registration or login screen but first when I click on any other point inside the scrolView e.g. enter Email or Name, then I can scrollDown, but in this window (Profil) I can not

enter image description here thanks for any Support

AKADO
  • 481
  • 1
  • 11
  • 19

1 Answers1

0

Solution is found, by using UiAutomator and UiSelector scrolling works.

driver.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().resourceId(\"<--your_resourceID-->"));"));

AKADO
  • 481
  • 1
  • 11
  • 19