javascrollleanft

LEANFT - [Web, Windows] Scrollable CLASS IS NOT WORKING with java


Unable to perform scrolling in a webpage and windows using LeanFT lib.

Code works fine, but It doesn't perform any scroll action.

import com.hp.lft.sdk.ScrollOrientation;
import com.hp.lft.sdk.ScrollType;
import com.hp.lft.sdk.Scrollable;

public class Sample {
    Scrollable scrollTo;
public void scrollDownUsingNative() throws GeneralLeanFtException {
scrollTo.scroll(ScrollOrientation.VERTICAL_SCROLL, ScrollType.LAST);
    }      
}

its quiet difficult to understand, kindly provide an explanation with examples.


Solution

  • Leanft provides Scrollbar class to work with scrollbars Leanft Java SDK Scrollbar. You can use it to scroll the window.

    For web, you need to use javascript.

    Sample code:

    Scrollbar scroll; public void scrollPage() { scroll.nextLine(); }

    Web

    Dim jvs jvs="window.scrollBy(0, 100);" Browser("").Page("").RunScript(myjs)

    PS: Do not forget to catch exceptions.