tianxiaobo / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 reported on code.google.com by Zaid.I.M...@gmail.com on 12 Sep 2013 at 11:22

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

Original comment by renasr...@gmail.com on 12 Sep 2013 at 6:10

GoogleCodeExporter commented 9 years ago
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

Original comment by Zaid.I.M...@gmail.com on 16 Sep 2013 at 12:27

GoogleCodeExporter commented 9 years ago
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 

Original comment by Zaid.I.M...@gmail.com on 16 Sep 2013 at 12:52