问题
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