microsoft / WinAppDriver

Windows Application Driver
MIT License
3.69k stars 1.4k forks source link

Touch interaction using Appium #1224

Open FrankieHoomer opened 4 years ago

FrankieHoomer commented 4 years ago

Hello! I want to simulate touch interactions for my app, but I met an issue: I see the appium attempts to touch the element I need (circle with cross in it under an element), but it does nothing 0oN1SBKkLP But If I start your test (e.g. ActionsTouch.Touch_Click_OriginElement()) at first, don't close the WinAppDriver.exe after it and try to run my tests, it works just fine.

I'm using: WinAppDriver v. 1.11.1809.18001; nuget Appium.WebDriver v. 4.1.1; nuget Selenium.Support 3.141.0; nuget Selenium.WebDriver 3.141.0.

Driver initialization:

Uri _windowsApplicationDriverUrl = new Uri("http://127.0.0.1:4723"); var options = new AppiumOptions(); options.AddAdditionalCapability("app", _process.AppPath); options.AddAdditionalCapability("deviceName", "WindowsPC"); options.AddAdditionalCapability("platformName", "Windows");

            _driver = new WindowsDriver<WindowsElement>(_windowsApplicationDriverUrl, options);

            if (_driver == null)
                throw new Exception("Desktop didn't run");
            _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            _driver.SwitchTo().Window(_driver.CurrentWindowHandle);

            _wait = new WebDriverWait(_driver, ITPTimeouts.WaitForConditionTimeSpan);
            _wait.IgnoreExceptionTypes(typeof(WebDriverException), typeof(NotFoundException),
                typeof(UnableToFindElementException));
            _wait.PollingInterval = ITPTimeouts.SessionPollingInterval;

Touch method: _tapActions = new TouchActions(_driver); _tapActions.SingleTap(_element); _tapActions.Perform();

I'd be very glad to get any help with this. Thank you!

anunay1 commented 4 years ago

Why do you want to close winappdriver.exe

FrankieHoomer commented 4 years ago

Why do you want to close winappdriver.exe

I just don't want to start other unit tests before I start my own.

FrankieHoomer commented 4 years ago

UPD: As far as more interesting. If I start the WAD, open my test app and let appium proceed, touch doesn't work, but if I leave the WAD console windows opened and start my test session again it's works well. So it seems to be the WAD initialization issue. Maybe something doesn't initialize at the first time?