# How to swipe in Webview

**URL:** <https://discuss.appium.io/t/how-to-swipe-in-webview/39566>\
**Category:** Support\
**Created:** [June 29, 2023, 3:02am UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566 "2023-06-29T03:02:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![dikistutmaz](https://discuss.appium.io/user_avatar/discuss.appium.io/dikistutmaz/32/10973_2.png) [@dikistutmaz](https://discuss.appium.io/u/dikistutmaz)\
**Post date:** [June 29, 2023, 3:02am UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/1 "2023-06-29T03:02:05Z")

</div>

Hello,

I need to swipe to the right and left between these cards in the webview.

I tried swipegestures but didn’t work,

What method should I follow?

thanks for help.

---

<div class="post-metadata">

**Author:** ![wreed](https://discuss.appium.io/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wreed](https://discuss.appium.io/u/wreed)\
**Post date:** [June 29, 2023, 5:22am UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/2 "2023-06-29T05:22:57Z")

</div>

> [@dikistutmaz](#):
>
> I tried swipegestures but didn’t work,

I’ve never even heard of swipegestures. Use TouchActions. Here is a tutorial with full github source:  
[https://www.swtestacademy.com/how-to-use-touch-actions-in-appium/](https://www.swtestacademy.com/how-to-use-touch-actions-in-appium/)

---

<div class="post-metadata">

**Author:** ![dikistutmaz](https://discuss.appium.io/user_avatar/discuss.appium.io/dikistutmaz/32/10973_2.png) [@dikistutmaz](https://discuss.appium.io/u/dikistutmaz)\
**Post date:** [June 29, 2023, 5:38pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/3 "2023-06-29T17:38:02Z")

</div>

Hi, I can use appium 2.0 Touchactions not possible,

---

<div class="post-metadata">

**Author:** ![wreed](https://discuss.appium.io/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wreed](https://discuss.appium.io/u/wreed)\
**Post date:** [June 29, 2023, 7:19pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/4 "2023-06-29T19:19:39Z")

</div>

My bad, here is the document on depreciation, and the list of alternatives:

> <https://github.com/appium/appium/issues/16009>

---

<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:** [June 29, 2023, 8:17pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/5 "2023-06-29T20:17:51Z")

</div>

add page source.  
1 you need only for android?  
2 you are with Java?

---

<div class="post-metadata">

**Author:** ![dikistutmaz](https://discuss.appium.io/user_avatar/discuss.appium.io/dikistutmaz/32/10973_2.png) [@dikistutmaz](https://discuss.appium.io/u/dikistutmaz)\
**Post date:** [June 30, 2023, 12:04pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/6 "2023-06-30T12:04:18Z")

</div>

Hi @Aleksei

Actually I need both, IOS,Android

Yes I 'm using java . Thanks for help.

---

<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:** [June 30, 2023, 12:28pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/7 "2023-06-30T12:28:23Z")

</div>

universal use -\> [How to swipe in a specific area until target element is show?](https://discuss.appium.io/t/how-to-swipe-in-a-specific-area-until-target-element-is-show/28154/18)

where scrolling points use needed element to scroll inside

```auto
        // start scroll from center of element
        Rectangle rectangle = el.getRect();
        int startX = rectangle.x + (rectangle.width / 2);
        int startY = rectangle.y + (rectangle.height / 2);
        int endY = 0;
        // now here calculate end points depending on direction needed

```

---

<div class="post-metadata">

**Author:** ![dikistutmaz](https://discuss.appium.io/user_avatar/discuss.appium.io/dikistutmaz/32/10973_2.png) [@dikistutmaz](https://discuss.appium.io/u/dikistutmaz)\
**Post date:** [June 30, 2023, 1:49pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/8 "2023-06-30T13:49:47Z")

</div>

Thanks for answer, specific to android Is there an easier solution?, because my farm 20 real devices.

I tried this code but didn’t work @Aleksei

> ```
> String text = "SMS";
> getDriver().findElement(AppiumBy.androidUIAutomator("new UiScrollable(new UiSelector()).setAsHorizontalList().scrollIntoView("
> + "new UiSelector().text(\""+text+"\"));"));
> 
> ```

---

<div class="post-metadata">

**Author:** ![dikistutmaz](https://discuss.appium.io/user_avatar/discuss.appium.io/dikistutmaz/32/10973_2.png) [@dikistutmaz](https://discuss.appium.io/u/dikistutmaz)\
**Post date:** [June 30, 2023, 2:55pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/9 "2023-06-30T14:55:12Z")

</div>

Thanks your help, my problem is solved this code, but for testing on real devices. I have to calculate coordinates for each device. Is there a stable solution? @Aleksei \>

> PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger  
> ");  
> Sequence tapSeq = new Sequence(finger, 1);  
> tapSeq.addAction(finger.createPointerMove(Duration.ofMillis(0),  
> PointerInput.Origin.viewport(), 979, 916));  
> tapSeq.addAction(finger.createPointerDown(PointerInput.MouseButton…asArg()));  
> tapSeq.addAction(finger.createPointerMove(Duration.ofMillis(200),  
> PointerInput.Origin.viewport(), 242, 913));  
> tapSeq.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));  
> getDriver().perform(Arrays.asList(tapSeq));  
> }

---

<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:** [July 1, 2023, 5:08am UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/10 "2023-07-01T05:08:46Z")

</div>

> [@dikistutmaz](#):
>
> Thanks for answer, specific to android Is there an easier solution?

Yes. Need page source

---

<div class="post-metadata">

**Author:** ![dikistutmaz](https://discuss.appium.io/user_avatar/discuss.appium.io/dikistutmaz/32/10973_2.png) [@dikistutmaz](https://discuss.appium.io/u/dikistutmaz)\
**Post date:** [July 5, 2023, 7:55pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/11 "2023-07-05T19:55:03Z")

</div>

Thanks @Aleksei

> <https://gist.github.com/ogloodos/a5f465c19c0416acc1a9ed8e01538a07>

---

<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:** [July 5, 2023, 8:02pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/12 "2023-07-05T20:02:32Z")

</div>

this is HTML. not result of

```auto
System.out.println(driver.getPageSource());

```

---

<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:** [July 5, 2023, 8:16pm UTC](https://discuss.appium.io/t/how-to-swipe-in-webview/39566/13 "2023-07-05T20:16:17Z")

</div>

> [@dikistutmaz](#):
>
> new UiScrollable(new UiSelector())

this code means take FIRST scrollView which can be wrong. see also [Appium cannot scroll when there is a tab with 'selected' attribute 'true' - #4 by Aleksei](https://discuss.appium.io/t/appium-cannot-scroll-when-there-is-a-tab-with-selected-attribute-true/39604/4)
