Unable to Run WinAppDriver.exe tests in TeamCity except when logged in with remote desktop.
Currently, our TeamCity agent (buildtest2) can run our WinAppDriver tests only when the agent user (builder) is logged in via remote desktop. If not, then the WinAppDriver can find the element, but not click on it. Log snip from the TeamCity build log below.
Windows is set to Developer mode, and the tests run fine if I am remoted in as the same user as TC uses to run them, I can see the app open and stuff is clicked not problem, the tests pass that way.
Any ideas how to fix? Is running in TeamCity headless mode not supported? The TC build agent is run as a process, not a service, so I can see that as a cmd window when I remote in, this was due to requirements from other tests. Not sure if that matters.
Windows Application Driver listening for requests at : http : / / 127 . 0 . 0 . 1 : 4723 /
Press ENTER to exit .
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
POST / session HTTP / 1 . 1
Accept : application / json , image / png
Connection : Keep - Alive
Content - Length : 217
Content - Type : application / json ; charset = utf - 8
Host : 127 . 0 . 0 . 1 : 4723
User - Agent : selenium / 3 . 141 . 0 ( . net windows )
X - Idempotency - Key : 678fd1c9 - 31f0 - 41fb - ab13 - 959d85ff01bf
HTTP / 1 . 1 200 OK
Content - Length : 154
Content - Type : application / json
{ " sessionId " : " A4171994 - F3E1 - 4A10 - A4BA - 9435303FB134 " , " status " : 0 , " value " : { " appTopLevelWindow " : " 310368 " , " ms : waitForAppLaunch " : " 25 " , " platformName " : " Windows " } }
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
POST / session / A4171994 - F3E1 - 4A10 - A4BA - 9435303FB134 / element HTTP / 1 . 1
Accept : application / json , image / png
Connection : Keep - Alive
Content - Length : 63
Content - Type : application / json ; charset = utf - 8
Host : 127 . 0 . 0 . 1 : 4723
User - Agent : selenium / 3 . 141 . 0 ( . net windows )
X - Idempotency - Key : 784576d1 - e73a - 4827 - 83f8 - 3446a3c86efa
{ " using " : " accessibility id " , " value " : " ConfigButtonTextBlock " }
HTTP / 1 . 1 200 OK
Content - Length : 102
Content - Type : application / json
{ " sessionId " : " A4171994 - F3E1 - 4A10 - A4BA - 9435303FB134 " , " status " : 0 , " value " : { " ELEMENT " : " 42 . 10945118 . 4 . 20 " } }
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
POST / session / A4171994 - F3E1 - 4A10 - A4BA - 9435303FB134 / element / 42 . 10945118 . 4 . 20 / click HTTP / 1 . 1
Accept : application / json , image / png
Connection : Keep - Alive
Content - Length : 2
Content - Type : application / json ; charset = utf - 8
Host : 127 . 0 . 0 . 1 : 4723
User - Agent : selenium / 3 . 141 . 0 ( . net windows )
X - Idempotency - Key : 351414ca - 5e4b - 4c6b - 8511 - 74dbd6ca2d1f
HTTP / 1 . 1 500 Internal Error
Content - Length : 133
Content - Type : application / json
{ " status " : 13 , " value " : { " error " : " unknown error " , " message " : " An unknown error occurred in the remote end while processing the command . " } }
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
POST / session / A4171994 - F3E1 - 4A10 - A4BA - 9435303FB134 / appium / app / close HTTP / 1 . 1
Accept : application / json , image / png
Connection : Keep - Alive
Content - Length : 2
Content - Type : application / json ; charset = utf - 8
Host : 127 . 0 . 0 . 1 : 4723
User - Agent : selenium / 3 . 141 . 0 ( . net windows )
X - Idempotency - Key : 2c0720a8 - 0fa2 - 4a3a - b640 - b245e3b7d8f4
{ }
HTTP / 1 . 1 200 OK
Content - Length : 63
Content - Type : application / json
{ " sessionId " : " A4171994 - F3E1 - 4A10 - A4BA - 9435303FB134 " , " status " : 0 }
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
DELETE / session / A4171994 - F3E1 - 4A10 - A4BA - 9435303FB134 HTTP / 1 . 1
Accept : application / json , image / png
Connection : Keep - Alive
Host : 127 . 0 . 0 . 1 : 4723
User - Agent : selenium / 3 . 141 . 0 ( . net windows )
X - Idempotency - Key : 3fe470aa - 258c - 4bcb - bfbc - e73bdcbebb96
HTTP / 1 . 1 200 OK
Content - Length : 12
Content - Type : application / json
Failed Test [15 s]
Error Message:
OpenQA.Selenium.WebDriverException : An unknown error occurred in the remote end while processing the command.
Stack Trace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver`1.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.Click()
....
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ```
You need to configure your agent to disable lockscreen and enable autologon. https://learn.microsoft.com/en-us/troubleshoot/windows-server/user-profiles-and-logon/turn-on-automatic-logon https://learn.microsoft.com/en-us/answers/questions/1283398/how-do-i-remove-the-lock-screen-entirely-from-wind