WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

OpenQA.Selenium.WebDriverException: An unknown error occurred in the remote end while processing the command.

Open azharashra05 opened this issue 2 years ago • 11 comments

Hi Sir/Mam, Greeting of the day

I am encountering an issue while running UI test cases for a desktop app on a self-hosted interactive agent (Microsoft Azure) through Azure Pipeline. As I mentioned, I'm using an interactive agent, so I need to manually start the agent using a CMD script and wait for the job to run. I'm getting an unknown error on the Microsoft hosted agent, but it's not as frequent as on the self-hosted agent. Upon investigation, I've discovered that this happens due to the RDP (Remote Desktop Protocol) Windows state being locked, which is used to connect the agent that runs the test cases. The test cases running on the Microsoft hosted agent fail less frequently compared to the self-hosted agent. I need to monitor the test cases on the self-hosted agent for them to pass. However, I don't want to monitor the test cases; I want them to run like they do on the Microsoft hosted agent. I'm using a self-hosted agent because these test cases require a higher configuration.

I am using Appium.WebDriver(4.3.1)

Please refer to the snapshot below. Could you please provide a solution to fix this issue? You can reach out to me at +91-7908140840 or [email protected]

UITestCaseError

Thanks & Regards Md Azhar Ashraf

azharashra05 avatar Sep 05 '23 14:09 azharashra05

That holds good for any automation not only windows, the PC should not be locked. Either disable the lock or else use tscon.exe to login with the current user check #1279

anunay1 avatar Sep 07 '23 15:09 anunay1

in the pipeline create a batch file for tscon.exe and run it before you start your tests.

anunay1 avatar Sep 07 '23 15:09 anunay1

Thanks @anunay1 for looking into the issue. I have already fixed this problem by creating a batch file and using tscon.exe to disconnect RDP and preserves UI session. However, I still need to log in on the interactive agent, run the agent in interactive mode, and then disconnect RDP using the batch file. I want to automate this step in pipeline and don't want manual intervention on agent.

azharashra05 avatar Sep 07 '23 15:09 azharashra05

Why do you want to do that? you can just configure the agent in the pipeline, azure gives you the option. And configure the agent run at startup when you install it,so it would always be running in an interactive mode.

anunay1 avatar Sep 07 '23 16:09 anunay1

@anunay1 The agent is configured in interactive mode. However, we currently need to manually log in to the agent and run the command .\run.cmd from the location C:\agent via the command prompt (cmd) to wait for job. Do you have any instances to prevent this and when we start the virtual machine from the pipeline, can it automatically wait for the job to run UI test cases?

azharashra05 avatar Sep 07 '23 16:09 azharashra05

When you install the agent it gives you an option to run at startup then why do you want to manually run run.cmd from command line

anunay1 avatar Sep 07 '23 16:09 anunay1

I don't want to run this step manually. But agent currently requires to run this command manually.May be it's configuration issue.I am sure that this options comes with service agent.I am not sure about interactive agent.If you have any references or documentation related this.Please share here any documentation or share your contact details to reached you out

azharashra05 avatar Sep 07 '23 16:09 azharashra05

Select yes for auto login Screenshot_2023-09-08-02-41-46-46_40deb401b9ffe8e1df2f1cc5ba480b12.jpg

anunay1 avatar Sep 07 '23 21:09 anunay1

https://techcommunity.microsoft.com/t5/healthcare-and-life-sciences/setup-azure-devops-self-hosted-agent-on-premise-amp/ba-p/3750154

anunay1 avatar Sep 07 '23 21:09 anunay1

Did it solved the issue?

anunay1 avatar Sep 08 '23 09:09 anunay1

We are in the process of reconfiguring the agent with autologon enabled. We will check after this; our process of UI testing is now working or not correctly. This issue is out of the scope of this. Hence, I am closing this ticket.

azharashra05 avatar Sep 08 '23 09:09 azharashra05