Xi 张熹
Xi 张熹

Reputation: 11071

Scroll a webview in Robotium?

How to automatically scroll a WebView down to bottom in Robotium?

We use a WebView to disaply EULA by the way.

Upvotes: 1

Views: 1045

Answers (3)

little qiang
little qiang

Reputation: 1

First answer is work, but it's not flexible

I think you can override the methond

clickOnWebElement(By by, int match, boolean scroll){}

write

solo.sendkey(Solo.DOWN);

into it

Upvotes: 0

Brian Yarger
Brian Yarger

Reputation: 1975

I've found that clicking on the view, then pressing the Down key some set number of times can do what you want. So something like:

solo.clickOnView(getActivity().findViewById(R.id.your_eula_webview_id));
for (int i=0;i<20;i++) {
    solo.sendKey(Solo.DOWN);
}

If that doesn't work, try finding something that does using the keyboard on the emulator, and then do the same with Robotium.

Upvotes: 1

Jimmy Collins
Jimmy Collins

Reputation: 3304

Have you tried using the scrollDown function?

Upvotes: 2

Related Questions