locked
Problem with Locating controls in UI Control Map RRS feed

  • Question

  • Hi everyone,

    I am having a very weird problem and have no idea what's going on. I am working on creating some Coded UI tests and I have noticed that, on my machine, when I go to a .uitest file, right click on one of the controls in the UI Control Map list, and select Locate the UI Control, the blue box always shows up about 2 inches up and 4 inches to the left of the specified control. Also, when I try to generate a new map by dragging the target tool to the app, it doesn't find the control correctly, but also appears to think the app is open in a different location than it actually is. The weirdest thing though, is that this functionality seems to work fine with web pages. It's only when I try to use it on a windows app that it has a problem. Any ideas?

    Thanks in advance,


    Aaron Sellers


    • Edited by gasellers Monday, January 19, 2015 6:18 PM
    Monday, January 19, 2015 6:17 PM

Answers

  • With a little help from my friends here at work, I was finally able to figure out what the problem was. I am on a very high resolution monitor and it was using it's native resolution which at 100% (96 DPI) can be a little too small to read, so I had bumped it up to 125%. This was causing Coded UI to fail to find the correct location on the screen for certain controls. Once I changed my DPI back to 96, it started to find everything correctly again. Seems like Coded UI should be able to handle a change in DPI though. 

    Aaron Sellers

    • Marked as answer by gasellers Friday, April 17, 2015 7:21 PM
    Friday, April 17, 2015 7:21 PM

All replies

  • Hi Aaron Sellers,

    According to your description, could you please tell me detailed steps how you generate a new map in the coded UI test?

    Generally, when we want to add new UI control in the UI Control Map list, we can right-click the CodedUITest method->Generate Code for Coded UI Test->Using Coded UI test builder like the following screen shot.

    Or we can also right-click the UIMap.uitest->Edit With Coded UI Test Builder like the following screen shot.

    So I suggest you can try the above suggestion to check your issue again.

    In addition, as you said that the weirdest thing though, is that this functionality seems to work fine with web pages. It's only when I try to use it on a windows app that it has a problem. Any ideas?

    I have been reproduced this issue in my side, I found that we can use the Locate the UI Control function to find the control for a windows app.

    So to further help you solve this issue, I suggest you can told me more detailed message about your issue.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 20, 2015 8:18 AM
  • In order to generate the map I launch the application I want to map and then right click on the .uitest file in the Solution Explorer and select 'Edit with Coded UI Test Builder'. Then I drag the target icon to the app, but the blue box that is generated doesn't correspond with any of the controls on the app. Like I said above, it's like it thinks the app is located in a different location.

    Aaron Sellers

    Tuesday, January 20, 2015 4:00 PM
  • Hi Aaron,

    Thanks for your reply.

    According to your description, I tried to record a button control in the calculator and then by right click on the .uitest file in the Solution Explorer and select 'Edit with Coded UI Test Builder'. I found that I can use the Locate the UI Control function to find the button control in UI Control Map list.

    So I suggest you can try my suggestions to check this issue again in your side.

    For example, after I right click on the .uitest file in the Solution Explorer and select 'Edit with Coded UI Test Builder', and then drag the add assertions option and then add a new control like the following screen shot.

    After you use the 1 add assertions option to add a control by the blue box, I suggest you can click the << option to show if the control be added into the UI Control Map.

    (1)If you can see the control be added into the UI Control Map and then select the first screen shot's 2 Add Assertion option to add an assert method and generated code.

    (2)If you did not see the control be added into the UI Control Map , I doubt that you may be not add the control successfully or the coded UI test is not support this control.

    If I misunderstand your issue, please provide some screen shot about your issue so that we will better help you.

    Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Tina-Shi Tuesday, January 27, 2015 1:31 AM
    • Unmarked as answer by gasellers Friday, April 17, 2015 7:16 PM
    Wednesday, January 21, 2015 10:50 AM
  • With a little help from my friends here at work, I was finally able to figure out what the problem was. I am on a very high resolution monitor and it was using it's native resolution which at 100% (96 DPI) can be a little too small to read, so I had bumped it up to 125%. This was causing Coded UI to fail to find the correct location on the screen for certain controls. Once I changed my DPI back to 96, it started to find everything correctly again. Seems like Coded UI should be able to handle a change in DPI though. 

    Aaron Sellers

    • Marked as answer by gasellers Friday, April 17, 2015 7:21 PM
    Friday, April 17, 2015 7:21 PM