locked
Get text from an accessible Status Bar RRS feed

  • Question

  • Hi,

    Its an MFC application that I am writing Coded UI tests for. There's a status bar at the end of every window I open in this application. This status bar is accessible to CUIT, but I am not able to get the text within it. Is there any workaround that could help me get the text?

    Thursday, October 25, 2012 8:42 AM

Answers

  • Hello PiaBarve,

    Glad to receive your reply.

    I am not very sure what the text in status bar looks like. But it seems that the Text can’t be recognized by Coded UI Test Builder directly and it is not a property of the control. So I suggest that you can try to achieve this text by hand coding. Maybe what you can do is to find the status bar control using searchproperties and then get the text based on the specific pane of the status bar control using some API.

    Maybe the following articles can help you:

    CStatusBarCtrl Class

    CStatusBarCtrl::GetText

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 7, 2012 9:42 AM
    Moderator

All replies

  • Hello PiaBarve,

    Thank you for posting in the MSDN forum.

    This status bar is accessible to CUIT, but I am not able to get the text within it.

    What is the “text”? Is a property of the status bar? How is the status bar like?

    If possible, you can provide us a screenshot of the tested UI about the status bar so that we can know what control you are working with.

    Now are you hand coding coded UI tests? If so, how have you tried to get the text within the status bar?

    You can provide your code in coded UI test so that we can further look at your issue.

    In addition, I suggest that you can generate coded UI test through actions recording using Coded UI Test Builder to check if you can get what you want. Sometimes it is a better way.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, October 26, 2012 4:07 AM
    Moderator
  • Hello PiaBarve.

    I find the "cross hairs" part of the Coded UI test recorder, the part that adds assertions, useful for examining things on the screen. Even if you are hand coding the tests, using the test recorder can provide details of field and property names and that may show you the data you require. There is no need to actually generate code, just explore the screen and then quit the test recorder.

    Regards

    Adrian

    Friday, October 26, 2012 7:56 AM
  • Hi PiaBarve,

    Have you solved this issue? Could you get useful information from the reply?

    If you have solved, please mark the useful reply as answer.

    If not, please let us know the latest news about this issue.

    Thank you for your understanding!



    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us


    Tuesday, October 30, 2012 6:24 AM
    Moderator
  • Hi Amanda,

    Sorry for the delay but i am yet not able to solve this issue. I am known to Coded UI and its basics so i have tried things with the cross hair and I am not handcoding, I am using the CUIT builder. It is an accessible control because coded ui recognizes it as a Status Bar. But I am not able to assert on the text displayed in this status bar. I tried UISpy to see if I get the text on it but no luck. I can't provide the screen shots at this moment but I used Property Inspector in Spy++.

    Kindly let me know how can i get the text on this status bar.


    • Edited by PiaBarve Wednesday, November 7, 2012 8:43 AM
    Wednesday, November 7, 2012 8:36 AM
  • Hello PiaBarve,

    Glad to receive your reply.

    I am not very sure what the text in status bar looks like. But it seems that the Text can’t be recognized by Coded UI Test Builder directly and it is not a property of the control. So I suggest that you can try to achieve this text by hand coding. Maybe what you can do is to find the status bar control using searchproperties and then get the text based on the specific pane of the status bar control using some API.

    Maybe the following articles can help you:

    CStatusBarCtrl Class

    CStatusBarCtrl::GetText

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 7, 2012 9:42 AM
    Moderator