Coder Social home page Coder Social logo

Member to perform a swipe about dotnet-client HOT 9 CLOSED

appium avatar appium commented on September 15, 2024
Member to perform a swipe

from dotnet-client.

Comments (9)

ytonthat avatar ytonthat commented on September 15, 2024

I just found out that swipes can be performed using this method: TouchActions.Flick(IWebElement, int, int, int)

from dotnet-client.

Astro03 avatar Astro03 commented on September 15, 2024

@ytonthat Have you figured out to use TouchActions? Or do you think i should still expose the Flick through the AppiumDriver class? I honestly don't care, we were just doing the best we could with the Selenium driver we were given.

from dotnet-client.

ytonthat avatar ytonthat commented on September 15, 2024

The TouchActions class allows us to do flick starting from an IWebElement

The Appium drivers in the other languages expose a swipe method that takes a start and end x and y location.
https://github.com/appium/appium/blob/master/docs/en/appium-bindings.md

I think you should expose a similar method to be consistent with the other languages

from dotnet-client.

Astro03 avatar Astro03 commented on September 15, 2024

I actually agree with you - I think we should be consistent with all the other languages.

As for the TouchActions Flick method, you can totally give it an speedX and speedY and run it. (It's one of the overloaded methods).

I will get around to it when I have time, or you're more than welcome to do it and I'll merge it into the codebase.

Cheers,
ASTRO

from dotnet-client.

ytonthat avatar ytonthat commented on September 15, 2024

Thank for the suggestion!
I believe the overloaded method should be used when you don't care about the start x and y coordinates. I actually have a use case in which I need to specify a stating location. To open a navigation drawer in Android, you must start swiping from the far left of your screen. There is no view that represents the edges of the screen in the app I am testing :(

from dotnet-client.

ytonthat avatar ytonthat commented on September 15, 2024

I just tried the new client (1.0.0) with appium server 1.1.0. The new gestures api is awesome. I use this extension method to perform swipes on x/y coordinates and it works fine:

    public static void Swipe(this AppiumDriver driver, Location start, Location end)
    {
        if (driver == null)
        {
            throw new ArgumentNullException("driver");
        }

        if (start == null)
        {
            throw new ArgumentNullException("start");
        }

        if (end == null)
        {
            throw new ArgumentNullException("end");
        }

        ITouchAction action = new TouchAction(driver).Press(start.X, start.Y)
                                                     .Wait(ms: 800)
                                                     .MoveTo(end.X, end.Y)
                                                     .Release();
        action.Perform();
    }

from dotnet-client.

imsardine avatar imsardine commented on September 15, 2024

@ytonthat To open the navigation drawer, what coordinates did you pass to the Swipe method? Press(0, 100) doesn't work for me, and Press(-1, 100) results in an error message "An unknown server-side error occurred while processing the command."

from dotnet-client.

ytonthat avatar ytonthat commented on September 15, 2024

I use x = 1 as a starting point for opening drawers

from dotnet-client.

imsardine avatar imsardine commented on September 15, 2024

@ytonthat thanks for the information. Interestingly, I found x-coordinate of the starting point could be any small numbers other than zero.

from dotnet-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.