microsoft / WinAppDriver

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

OpenQA.Selenium.WebDriverException: Access is denied when Mouse.MouseMove #1009

Open alex1yaremchuk opened 4 years ago

alex1yaremchuk commented 4 years ago

Hi, Help needed!

I used session.Mouse.MouseMove for my simple WinForms test to move mouse to the control which I wasn't able to locate with ids (inspect displays it outside of the application's tree, might be a separate question why).

It worked fine as I was running it, but on night run it failed as

Error Message: Test method UiTests.ScenarioCreateNewDb.CreateNewDb threw exception: OpenQA.Selenium.WebDriverException: Access is denied Stack Trace: at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Appium.AppiumDriver1.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteMouse.MouseMove(ICoordinates where, Int32 offsetX, Int32 offsetY)

Might be it has something to do with the locked state of the PC?

Thanks!

alex1yaremchuk commented 4 years ago

Help myself https://github.com/Microsoft/WinAppDriver/issues/477

It seems to be as designed.

Open question - how to set up CI, nightly builds with this limitation?

Issue can be closed I think.

hassanuz commented 4 years ago

What service are you using for CI? On Azure DevOps it is recommended to use an interactive agent for UI automation scenarios. DevOps should automatically take care of the logging in process for the agent.

You'd want to make sure whatever CI service you have is able to bypass the lock screen.

alex1yaremchuk commented 4 years ago

Hi, thanks for the reply!

We're using TFS Builds. Server version is 2019.0.1

alex1yaremchuk commented 4 years ago

Our admins say that any auto-login is unsafe. Is there some resource about security of using interactive agents (whatever it is)?

naeemakram commented 4 years ago

Windows automation scripts need to interact with the desktop, an active session is a prerequisite since the dawn of times. You will need an active, unlocked machine. There's no way around it.