How to install software automatically with Coded UI in C#

﹥>﹥吖頭↗ 提交于 2019-12-13 01:45:43

问题


I'm developing a tool which will automatically install a software in PC. I'm trying to do this with Coded UI in visual studio 2013.
To install the software I need to click on the "Next" button on setup window. But when I click on the button its showing a warning -

Access to the application is denied

Here is the screenshot of the issue -

How can i automate the process?
Is there any better approach rather than Coded UI that I should think about to install the software automatically?


回答1:


Just run Visual Studio 2013 in Administrator mode.
See this thread to get more clear idea.




回答2:


You can try using Win32 API methods inside the generated test method to get the window handle for the next button control and see if either 'send message' or 'post message' (win32 api methods) can be manually added to achieve the required click action. For more details about win32 api methods usage and commonly used methods please refer the below links:

https://msdn.microsoft.com/en-us/library/windows/desktop/ff468919(v=vs.85).aspx

http://www.c-sharpcorner.com/UploadFile/SamTomato/clicking-a-button-in-another-application/



来源:https://stackoverflow.com/questions/33710589/how-to-install-software-automatically-with-coded-ui-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!