microsoft / WinAppDriver

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

WinAppDriver Starting/Stopping Task in azure devops not working as expected #1434

Open vishnuprakash9845 opened 3 years ago

vishnuprakash9845 commented 3 years ago

I am currently automating the UWP application, so in the azure devops I tried to Include the WinAppDriver task to start the WinAppDriver server. But when I check the VM where the tests will run(Self hosted agent), I dont see winappdriver running or anything like that.

Bit confused with this task and how it works, can anyone please help me.

https://marketplace.visualstudio.com/items?itemName=WinAppDriver.winappdriver-pipelines-task

Configured Task in Azure Devops image

After running the Pipeline image

Also when I tried to programmatically start the winappdriver like below its not working in VM, but working fine in Local machine where I build the code.

string winAppDriverPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"Windows Application Driver\WinAppDriver.exe"); Process.Start(winAppDriverPath);

anunay1 commented 3 years ago

Are your tests working?

Shakevg commented 3 years ago

@vishnuprakash9845 Maybe something with rights... Is WinAppDriver starting manually on the same Agent with the same session as Agent running? Could you look manually at what happened on Agent when the Start WinnAppDriver task is running (This task starting Powershell console from which running WinAppDriver)? Could you post the Stop WinnAppDriver task log (because it displays a log of the WinAppDriver console)?

ben-polinsky commented 3 years ago

I ran into this and am trying to remember the steps I took to resolve:

Have you:

And as @Shakevg mentioned above, the Winappdriver Stop task output would be useful as well.

vishnuprakash9845 commented 3 years ago

@Shakevg

Sorry for my late reply. Had to relocate to differnt location due to Pandemic

tried all the possible ways to resolve not getting any lead on this. Any one on the community [@anunay1 , @Shakevg , @timheuer , @not-the-car ] please help me.

1. Yes WinAppDriver is launching when I start manually on the same agent machine [VM1] 2. When I run WinAppDriver manually everything works as normal with below logs screenshot. All Tests will pass image

3. Posting the Stop WinAppDriver logs image

2021-05-29T10:32:37.6112549Z ##[section]Starting: Stop - WinAppDriver 2021-05-29T10:32:37.6285260Z ============================================================================== 2021-05-29T10:32:37.6285590Z Task : WinAppDriver 2021-05-29T10:32:37.6285959Z Description : Use this extention to integrate Windows Application Driver (WinAppDriver) into your Azure Pipeline. 2021-05-29T10:32:37.6286283Z Version : 0.0.2 2021-05-29T10:32:37.6286483Z Author : Microsoft 2021-05-29T10:32:37.6286880Z Help : Checkout the WinAppDriver GitHub Repo to learn more - https://github.com/Microsoft/WinAppDriver 2021-05-29T10:32:37.6287298Z ============================================================================== 2021-05-29T10:32:39.2911464Z Attempting to close WinAppDriver on Agent 2021-05-29T10:32:49.2832025Z 2021-05-29T10:32:49.2841926Z Printing WinAppDriver Console logs: 2021-05-29T10:32:49.2845461Z 2021-05-29T10:32:49.2897836Z Windows Application Driver listening for requests at: http://127.0.0.1:4723/ 2021-05-29T10:32:49.2898452Z Press ENTER to exit. 2021-05-29T10:32:49.2900285Z 2021-05-29T10:32:49.2901633Z 2021-05-29T10:32:49.2903053Z ========================================== 2021-05-29T10:32:49.2904103Z POST /session HTTP/1.1 2021-05-29T10:32:49.2904970Z 2021-05-29T10:32:49.2906860Z Accept: application/json, image/png 2021-05-29T10:32:49.2907338Z 2021-05-29T10:32:49.2908853Z Connection: Keep-Alive 2021-05-29T10:32:49.2909363Z 2021-05-29T10:32:49.2910732Z Content-Length: 226 2021-05-29T10:32:49.2911797Z 2021-05-29T10:32:49.2915619Z Content-Type: application/json;charset=utf-8 2021-05-29T10:32:49.2916638Z 2021-05-29T10:32:49.2917879Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.2918603Z 2021-05-29T10:32:49.2920086Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.2921331Z 2021-05-29T10:32:49.2922399Z 2021-05-29T10:32:49.2924329Z 2021-05-29T10:32:49.2925618Z 2021-05-29T10:32:49.2926689Z 2021-05-29T10:32:49.2927742Z 2021-05-29T10:32:49.2929146Z ========================================== 2021-05-29T10:32:49.2929953Z POST /session HTTP/1.1 2021-05-29T10:32:49.2931006Z 2021-05-29T10:32:49.2932367Z Accept: application/json, image/png 2021-05-29T10:32:49.2932866Z 2021-05-29T10:32:49.2934575Z Connection: Keep-Alive 2021-05-29T10:32:49.2935421Z 2021-05-29T10:32:49.2936844Z Content-Length: 147 2021-05-29T10:32:49.2937931Z 2021-05-29T10:32:49.2939442Z Content-Type: application/json;charset=utf-8 2021-05-29T10:32:49.2940089Z 2021-05-29T10:32:49.2941583Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.2942120Z 2021-05-29T10:32:49.2943812Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.2944279Z 2021-05-29T10:32:49.2945576Z 2021-05-29T10:32:49.2946911Z 2021-05-29T10:32:49.2949031Z {"desiredCapabilities":{"platformName":"Windows","app":"Root","deviceName":"WindowsPC"},"capabilities":{"firstMatch":[{"platformName":"Windows"}]}} 2021-05-29T10:32:49.2950155Z HTTP/1.1 200 OK 2021-05-29T10:32:49.2951441Z 2021-05-29T10:32:49.2953233Z Content-Length: 111 2021-05-29T10:32:49.2954632Z 2021-05-29T10:32:49.2956624Z Content-Type: application/json 2021-05-29T10:32:49.2957267Z 2021-05-29T10:32:49.2958578Z 2021-05-29T10:32:49.2959559Z 2021-05-29T10:32:49.2961307Z {"sessionId":"E7016455-A206-4C32-B30D-3B58FA8E67D7","status":0,"value":{"app":"Root","platformName":"Windows"}} 2021-05-29T10:32:49.2962324Z 2021-05-29T10:32:49.2963774Z 2021-05-29T10:32:49.2965169Z ========================================== 2021-05-29T10:32:49.2966401Z POST /session/E7016455-A206-4C32-B30D-3B58FA8E67D7/elements HTTP/1.1 2021-05-29T10:32:49.2967072Z 2021-05-29T10:32:49.2968679Z Accept: application/json, image/png 2021-05-29T10:32:49.2969443Z 2021-05-29T10:32:49.2970972Z Content-Length: 55 2021-05-29T10:32:49.2971979Z 2021-05-29T10:32:49.2973452Z Content-Type: application/json;charset=utf-8 2021-05-29T10:32:49.2974247Z 2021-05-29T10:32:49.2975507Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.2976354Z 2021-05-29T10:32:49.2977683Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.2980563Z 2021-05-29T10:32:49.2980659Z 2021-05-29T10:32:49.2981011Z 2021-05-29T10:32:49.2982715Z {"using":"class name","value":"ApplicationFrameWindow"} 2021-05-29T10:32:49.2983706Z HTTP/1.1 200 OK 2021-05-29T10:32:49.2984622Z 2021-05-29T10:32:49.2985885Z Content-Length: 74 2021-05-29T10:32:49.2986734Z 2021-05-29T10:32:49.2988016Z Content-Type: application/json 2021-05-29T10:32:49.2988812Z 2021-05-29T10:32:49.2989865Z 2021-05-29T10:32:49.2990903Z 2021-05-29T10:32:49.2992299Z {"sessionId":"E7016455-A206-4C32-B30D-3B58FA8E67D7","status":0,"value":[]} 2021-05-29T10:32:49.2993076Z 2021-05-29T10:32:49.2994118Z 2021-05-29T10:32:49.2995404Z ========================================== 2021-05-29T10:32:49.2996606Z POST /session/E7016455-A206-4C32-B30D-3B58FA8E67D7/window/current/maximize HTTP/1.1 2021-05-29T10:32:49.2997282Z 2021-05-29T10:32:49.2998626Z Accept: application/json, image/png 2021-05-29T10:32:49.2999179Z 2021-05-29T10:32:49.3000652Z Content-Length: 2 2021-05-29T10:32:49.3001794Z 2021-05-29T10:32:49.3003421Z Content-Type: application/json;charset=utf-8 2021-05-29T10:32:49.3004199Z 2021-05-29T10:32:49.3005754Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.3006611Z 2021-05-29T10:32:49.3007932Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.3008772Z 2021-05-29T10:32:49.3009816Z 2021-05-29T10:32:49.3010833Z 2021-05-29T10:32:49.3012090Z {} 2021-05-29T10:32:49.3013166Z HTTP/1.1 500 Internal Error 2021-05-29T10:32:49.3014703Z 2021-05-29T10:32:49.3017484Z Content-Length: 165 2021-05-29T10:32:49.3018458Z 2021-05-29T10:32:49.3020135Z Content-Type: application/json 2021-05-29T10:32:49.3021005Z 2021-05-29T10:32:49.3022081Z 2021-05-29T10:32:49.3023132Z 2021-05-29T10:32:49.3024693Z {"status":104,"value":{"error":"unsupported operation","message":"Indicates that a command that should have executed properly cannot be supported for some reason."}} 2021-05-29T10:32:49.3025226Z 2021-05-29T10:32:49.3026342Z 2021-05-29T10:32:49.3027869Z ========================================== 2021-05-29T10:32:49.3029305Z POST /session HTTP/1.1 2021-05-29T10:32:49.3030522Z 2021-05-29T10:32:49.3031980Z Accept: application/json, image/png 2021-05-29T10:32:49.3032884Z 2021-05-29T10:32:49.3034185Z Connection: Keep-Alive 2021-05-29T10:32:49.3035006Z 2021-05-29T10:32:49.3036295Z Content-Length: 226 2021-05-29T10:32:49.3037156Z 2021-05-29T10:32:49.3038501Z Content-Type: application/json;charset=utf-8 2021-05-29T10:32:49.3039323Z 2021-05-29T10:32:49.3040607Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.3041469Z 2021-05-29T10:32:49.3042748Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.3043564Z 2021-05-29T10:32:49.3044637Z 2021-05-29T10:32:49.3045648Z 2021-05-29T10:32:49.3046702Z 2021-05-29T10:32:49.3047970Z HTTP/1.1 500 Internal Error 2021-05-29T10:32:49.3048590Z 2021-05-29T10:32:49.3050049Z Content-Length: 194 2021-05-29T10:32:49.3051122Z 2021-05-29T10:32:49.3052787Z Content-Type: application/json 2021-05-29T10:32:49.3053718Z 2021-05-29T10:32:49.3055007Z 2021-05-29T10:32:49.3056100Z 2021-05-29T10:32:49.3057819Z {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: Company.Digi_78aqb0kyn8f3w!App, and processId: 6744"}} 2021-05-29T10:32:49.3058379Z 2021-05-29T10:32:49.3059311Z 2021-05-29T10:32:49.3060647Z ========================================== 2021-05-29T10:32:49.3061692Z POST /session HTTP/1.1 2021-05-29T10:32:49.3062542Z 2021-05-29T10:32:49.3063813Z Accept: application/json, image/png 2021-05-29T10:32:49.3064656Z 2021-05-29T10:32:49.3065961Z Connection: Keep-Alive 2021-05-29T10:32:49.3066844Z 2021-05-29T10:32:49.3068135Z Content-Length: 147 2021-05-29T10:32:49.3068985Z 2021-05-29T10:32:49.3070288Z Content-Type: application/json;charset=utf-8 2021-05-29T10:32:49.3071075Z 2021-05-29T10:32:49.3072370Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.3073177Z 2021-05-29T10:32:49.3074499Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.3075738Z 2021-05-29T10:32:49.3076532Z 2021-05-29T10:32:49.3077731Z 2021-05-29T10:32:49.3079451Z {"desiredCapabilities":{"platformName":"Windows","app":"Root","deviceName":"WindowsPC"},"capabilities":{"firstMatch":[{"platformName":"Windows"}]}} 2021-05-29T10:32:49.3080101Z HTTP/1.1 200 OK 2021-05-29T10:32:49.3081136Z 2021-05-29T10:32:49.3082376Z Content-Length: 111 2021-05-29T10:32:49.3083405Z 2021-05-29T10:32:49.3084784Z Content-Type: application/json 2021-05-29T10:32:49.3085521Z 2021-05-29T10:32:49.3086638Z 2021-05-29T10:32:49.3087704Z 2021-05-29T10:32:49.3089188Z {"sessionId":"1FFD03E0-6D3F-43CD-B7B8-0E1C89D1BC75","status":0,"value":{"app":"Root","platformName":"Windows"}} 2021-05-29T10:32:49.3089617Z 2021-05-29T10:32:49.3090866Z 2021-05-29T10:32:49.3092276Z ========================================== 2021-05-29T10:32:49.3093172Z POST /session/1FFD03E0-6D3F-43CD-B7B8-0E1C89D1BC75/elements HTTP/1.1 2021-05-29T10:32:49.3094154Z 2021-05-29T10:32:49.3095504Z Accept: application/json, image/png 2021-05-29T10:32:49.3096294Z 2021-05-29T10:32:49.3097568Z Content-Length: 55 2021-05-29T10:32:49.3098420Z 2021-05-29T10:32:49.3099703Z Content-Type: application/json;charset=utf-8 2021-05-29T10:32:49.3100510Z 2021-05-29T10:32:49.3101780Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.3102614Z 2021-05-29T10:32:49.3103966Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.3104746Z 2021-05-29T10:32:49.3105762Z 2021-05-29T10:32:49.3106805Z 2021-05-29T10:32:49.3108144Z {"using":"class name","value":"ApplicationFrameWindow"} 2021-05-29T10:32:49.3109118Z HTTP/1.1 200 OK 2021-05-29T10:32:49.3109987Z 2021-05-29T10:32:49.3111861Z Content-Length: 74 2021-05-29T10:32:49.3113126Z 2021-05-29T10:32:49.3114725Z Content-Type: application/json 2021-05-29T10:32:49.3116866Z 2021-05-29T10:32:49.3118132Z 2021-05-29T10:32:49.3119288Z 2021-05-29T10:32:49.3120709Z {"sessionId":"1FFD03E0-6D3F-43CD-B7B8-0E1C89D1BC75","status":0,"value":[]} 2021-05-29T10:32:49.3121480Z 2021-05-29T10:32:49.3122500Z 2021-05-29T10:32:49.3124150Z ========================================== 2021-05-29T10:32:49.3125821Z POST /session/1FFD03E0-6D3F-43CD-B7B8-0E1C89D1BC75/window/current/maximize HTTP/1.1 2021-05-29T10:32:49.3126738Z 2021-05-29T10:32:49.3128070Z Accept: application/json, image/png 2021-05-29T10:32:49.3129239Z 2021-05-29T10:32:49.3130705Z Content-Length: 2 2021-05-29T10:32:49.3131567Z 2021-05-29T10:32:49.3132888Z Content-Type: application/json;charset=utf-8 2021-05-29T10:32:49.3133698Z 2021-05-29T10:32:49.3136570Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.3136792Z 2021-05-29T10:32:49.3137273Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.3138511Z 2021-05-29T10:32:49.3139582Z 2021-05-29T10:32:49.3140633Z 2021-05-29T10:32:49.3141861Z {} 2021-05-29T10:32:49.3143017Z HTTP/1.1 500 Internal Error 2021-05-29T10:32:49.3143834Z 2021-05-29T10:32:49.3145129Z Content-Length: 165 2021-05-29T10:32:49.3145931Z 2021-05-29T10:32:49.3147216Z Content-Type: application/json 2021-05-29T10:32:49.3148041Z 2021-05-29T10:32:49.3149070Z 2021-05-29T10:32:49.3150105Z 2021-05-29T10:32:49.3151660Z {"status":104,"value":{"error":"unsupported operation","message":"Indicates that a command that should have executed properly cannot be supported for some reason."}} 2021-05-29T10:32:49.3152180Z 2021-05-29T10:32:49.3153246Z 2021-05-29T10:32:49.3154557Z ========================================== 2021-05-29T10:32:49.3155640Z GET /session/1FFD03E0-6D3F-43CD-B7B8-0E1C89D1BC75/screenshot HTTP/1.1 2021-05-29T10:32:49.3156401Z 2021-05-29T10:32:49.3157693Z Accept: application/json, image/png 2021-05-29T10:32:49.3158559Z 2021-05-29T10:32:49.3159852Z Cache-Control: no-cache 2021-05-29T10:32:49.3160702Z 2021-05-29T10:32:49.3161998Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.3162828Z 2021-05-29T10:32:49.3164370Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.3166070Z 2021-05-29T10:32:49.3167429Z 2021-05-29T10:32:49.3168973Z 2021-05-29T10:32:49.3170018Z 2021-05-29T10:32:49.3171397Z HTTP/1.1 500 Internal Error 2021-05-29T10:32:49.3172131Z 2021-05-29T10:32:49.3173401Z Content-Length: 133 2021-05-29T10:32:49.3174246Z 2021-05-29T10:32:49.3175513Z Content-Type: application/json 2021-05-29T10:32:49.3176330Z 2021-05-29T10:32:49.3177375Z 2021-05-29T10:32:49.3178411Z 2021-05-29T10:32:49.3180542Z {"status":13,"value":{"error":"unknown error","message":"An unknown error occurred in the remote end while processing the command."}} 2021-05-29T10:32:49.3181399Z 2021-05-29T10:32:49.3182450Z 2021-05-29T10:32:49.3183767Z ========================================== 2021-05-29T10:32:49.3184904Z GET /session/1FFD03E0-6D3F-43CD-B7B8-0E1C89D1BC75/window_handles HTTP/1.1 2021-05-29T10:32:49.3185709Z 2021-05-29T10:32:49.3187024Z Accept: application/json, image/png 2021-05-29T10:32:49.3187862Z 2021-05-29T10:32:49.3189220Z Cache-Control: no-cache 2021-05-29T10:32:49.3190001Z 2021-05-29T10:32:49.3191270Z Connection: Keep-Alive 2021-05-29T10:32:49.3192167Z 2021-05-29T10:32:49.3193408Z Host: 127.0.0.1:4723 2021-05-29T10:32:49.3194293Z 2021-05-29T10:32:49.3195628Z User-Agent: selenium/3.141.0 (.net windows) 2021-05-29T10:32:49.3196398Z 2021-05-29T10:32:49.3197458Z 2021-05-29T10:32:49.3198488Z 2021-05-29T10:32:49.3199529Z 2021-05-29T10:32:49.3200771Z HTTP/1.1 200 OK 2021-05-29T10:32:49.3201638Z 2021-05-29T10:32:49.3202894Z Content-Length: 74 2021-05-29T10:32:49.3203717Z 2021-05-29T10:32:49.3205016Z Content-Type: application/json 2021-05-29T10:32:49.3205860Z 2021-05-29T10:32:49.3206891Z 2021-05-29T10:32:49.3207921Z 2021-05-29T10:32:49.3209310Z {"sessionId":"1FFD03E0-6D3F-43CD-B7B8-0E1C89D1BC75","status":0,"value":[]} 2021-05-29T10:32:49.3533298Z ##[section]Finishing: Stop - WinAppDriver

Shakevg commented 3 years ago

@vishnuprakash9845 I suppose your desktop session is locked. Did you configure a Self-hosted agent according to instruction https://docs.microsoft.com/en-us/azure/devops/pipelines/test/ui-testing-considerations?view=azure-devops&tabs=mstest#visible-ui-mode? Can you check test running with active maximized RDP session? Could you provide the code sample that you are using?

vishnuprakash9845 commented 3 years ago

@Shakevg Thank you for the quick turnaround.

I have configured the agent to run as service, now reconfigured as per the instructions from the document for autologon as per below image.

Triggered couple of tests, its running fine. Let me monitor for couple of days.

image

how to achieve active maximized RDP session? Are yo referring to set Display Configurations as per below image

image

Due to some copyrights I am not supposed to share the entire code base. but can share the app launch code

image

Shakevg commented 3 years ago

@vishnuprakash9845 how to achieve an active maximized RDP session? Are you referring to set Display Configurations as per below image I just mean open RDP and do not collapse it - check is it working or not. Then correctly close the session according to the instruction above and re-check. Also, I propose to delete "ms:waitForAppLaunch" option because per my experience it can cause problems.

rarajabs commented 3 years ago

I am not too sure about the error log. But I have encountered similar issue before: My test able to run when I remote to the machine, but not able to run if the machine without remote in.

I had add 1 devops task before test task, then it solve my issue. Maybe you can try to have a look.

Screen Resolution Utility

Just run this task before your test task, and see if it able to help.