问题
I have a Coded UI test for a WinForms application. Running the test on my developer computer (Windows 7) works fine, but on the test agent running tests nightly clicking a toolbar button fails the third (!) time it is being clicked in the test. The button opens a new window in the application (which it does the first 2 times an in multiple other tests). Looking at the test executing it seems like the mouse hoovers over the button, the test log reports that the button was clicked, but the test then fails because it cannot find the window the button should open.
What I am looking for is any known issues or similar in Coded UI tests which I need to know of possible to cause this behavior?
回答1:
I think Due to resolution changes or something your test is not able to find the recorded position of the button third time.
I would suggest you to use GetClickablePoint()
method to search for a button irrespective of its position on the screen.
You can refer to this.
Cheers.
来源:https://stackoverflow.com/questions/12347637/coded-ui-tests-clicking-button-does-suddenly-not-work