# What options are available to me in driver.execute\_script 'mobile: scroll' in the ruby bindings

**URL:** <https://discuss.appium.io/t/what-options-are-available-to-me-in-driver-execute-script-mobile-scroll-in-the-ruby-bindings/16090>\
**Category:** Support\
**Created:** [April 19, 2017, 2:02pm UTC](https://discuss.appium.io/t/what-options-are-available-to-me-in-driver-execute-script-mobile-scroll-in-the-ruby-bindings/16090 "2017-04-19T14:02:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmck91](https://discuss.appium.io/user_avatar/discuss.appium.io/pmck91/32/2605_2.png) [@pmck91](https://discuss.appium.io/u/pmck91)\
**Post date:** [April 19, 2017, 2:02pm UTC](https://discuss.appium.io/t/what-options-are-available-to-me-in-driver-execute-script-mobile-scroll-in-the-ruby-bindings/16090/1 "2017-04-19T14:02:15Z")

</div>

I’ve searched high and low and can’t find the doc section about it.

```
execute_script 'mobile: scroll', direction: 'down'

```

is what I’m calling now but it scrolls far too long. how can I say set the duration of the scroll? Or scroll until I find an element. What are other interesting things possible with the execute script, and where can I find the documents on it?

Any help much appreciated.

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [April 19, 2017, 2:09pm UTC](https://discuss.appium.io/t/what-options-are-available-to-me-in-driver-execute-script-mobile-scroll-in-the-ruby-bindings/16090/2 "2017-04-19T14:09:52Z")

</div>

@pmck91[How to ScrollToElement in appium v1.0.0-beta.5](https://discuss.appium.io/t/how-to-scrolltoelement-in-appium-v1-0-0-beta-5/15716) - exactly you are looking for

---

<div class="post-metadata">

**Author:** ![pmck91](https://discuss.appium.io/user_avatar/discuss.appium.io/pmck91/32/2605_2.png) [@pmck91](https://discuss.appium.io/u/pmck91)\
**Post date:** [April 19, 2017, 2:16pm UTC](https://discuss.appium.io/t/what-options-are-available-to-me-in-driver-execute-script-mobile-scroll-in-the-ruby-bindings/16090/3 "2017-04-19T14:16:03Z")

</div>

Thanks! I’m looking for something in the ruby appium\_lib though, but this points in the right direction

---

<div class="post-metadata">

**Author:** ![willosser](https://discuss.appium.io/user_avatar/discuss.appium.io/willosser/32/2454_2.png) [@willosser](https://discuss.appium.io/u/willosser)\
**Post date:** [April 20, 2017, 1:47pm UTC](https://discuss.appium.io/t/what-options-are-available-to-me-in-driver-execute-script-mobile-scroll-in-the-ruby-bindings/16090/4 "2017-04-20T13:47:10Z")

</div>

Here’s a ruby example of scrolling explicitly.

```
  size = appium_driver.driver.manage.window.size
  width = size.width
  start_x = end_x = (width / 2).to_int
  (start_y, end_y) = [(size.height * 0.8).to_int, (size.height * 0.2).to_int]
  Appium::TouchAction.new.swipe(start_x: start_x,
                                start_y: start_y,
                                end_x: end_x,
                                end_y: end_y,
                                duration: 1000)
```

---

<div class="post-metadata">

**Author:** ![pmck91](https://discuss.appium.io/user_avatar/discuss.appium.io/pmck91/32/2605_2.png) [@pmck91](https://discuss.appium.io/u/pmck91)\
**Post date:** [April 21, 2017, 11:21am UTC](https://discuss.appium.io/t/what-options-are-available-to-me-in-driver-execute-script-mobile-scroll-in-the-ruby-bindings/16090/5 "2017-04-21T11:21:55Z")

</div>

This is perfect! thank you!
