RobotiumTech / robotium

Android UI Testing
http://www.robotium.org
Apache License 2.0
2.86k stars 787 forks source link

Scrolling a div (which is actually a carousel) inside a WebView . #599

Closed renas closed 9 years ago

renas commented 9 years ago

From Zaid.I.M...@gmail.com on September 12, 2013 04:22:33

Hi Renas,

I'm testing a android Hybrid app, which has an index page consisting of native android headers and the rest of the page is a webview.

The webview has a "small div which is actually a carousel" that has some images in it.

How do i scroll(right to left and vice-verse) this div carousel with robotium?

I did trying using waitForWebElement(By by, int timeout, boolean scroll) but it couldn't help me out. And its not clear the scroll parameter , scrolls left,right,top or bottom.

Would be great if i get your valuable inputs on the same.

Thanks, Zaid

Original issue: http://code.google.com/p/robotium/issues/detail?id=520

renas commented 9 years ago

From renasr...@gmail.com on September 12, 2013 11:10:38

Hi, Unfortunately that is not possible. What you can do is to use solo.drag() and scroll that way.

Status: WontFix
Owner: renasr...@gmail.com

renas commented 9 years ago

From Zaid.I.M...@gmail.com on September 16, 2013 05:27:20

Thanks Renas.

But still it did not work for me as I want to scroll a carousel under a webview.

Yet I have another issue , How do I hit an enter key in a TextBox which is housed under a WebView.?

I tried using this.solo.typeTextInWebElement(By.xpath("Xpath of the Search Text Box"), this.solo.sendKey(13)); //13 being ASCII Value for ENTER

But it throws an error at this.solo.sendKey(13) as we need to send in the String as a second parameter.

Need your inputs/aid on the same.

Regards, Zaid

renas commented 9 years ago

From Zaid.I.M...@gmail.com on September 16, 2013 05:52:06

Sorry to bother you Renas.

But I found a solution for my previous query.

First I took the control focus to the Search Text Box using,

this.solo.clickOnWebElement(By.xpath("Xpath of the Search Text Box"));

and then i used,

this.solo.sendKey(KeyEvent.KEYCODE_ENTER);

Could successfully hit an enter into the text box.

Regards, Zaid