locked
Dynamic test object RRS feed

  • Question

  • I had application where i see its name is dynamic

     <PropertyCondition Name="Name">Welcome: App Tours - Microsoft Internet Explorer</PropertyCondition>

     <PropertyCondition Name="Name">Welcome: App Tours </PropertyCondition>

     <PropertyCondition Name="Name">Welcome: App Tours - Chromo</PropertyCondition>

    Observe in all above Welcome: App Tours is common. In QTP if i keep Welcome: App Tours.* tool will be able to identify the object what ever comes after Welcome: App Tours.

    Do we have similar solution 

    Wednesday, December 12, 2012 6:08 PM

Answers

  • Hello Chandu,

    Thank you for your post.

    If a control has a dynamic property, I suggest that you can use the “Contains” in the searchproperties to ensure that it is searching for a string containing the substring ” Welcome: App Tours”.

    For example:

    control.SearchProperties.Add("InnerText", " Welcome: App Tours ", PropertyExpressionOperator.Contains);

    For more detailed information, you can refer to this useful blog:

    Using regular expressions to locate controls in Coded UI Test

    Meanwhile according to the blog above, Anu has replied SHANMUGAVEL that we don't support this functionality using regexp unfortunately.

    Best regards


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda ZhuModerator Monday, December 17, 2012 1:23 AM
    • Unmarked as answer by chandu.k Monday, December 17, 2012 11:39 AM
    • Marked as answer by chandu.k Monday, December 17, 2012 11:39 AM
    Thursday, December 13, 2012 7:23 AM
    Moderator

All replies

  • Hello Chandu,

    Thank you for your post.

    If a control has a dynamic property, I suggest that you can use the “Contains” in the searchproperties to ensure that it is searching for a string containing the substring ” Welcome: App Tours”.

    For example:

    control.SearchProperties.Add("InnerText", " Welcome: App Tours ", PropertyExpressionOperator.Contains);

    For more detailed information, you can refer to this useful blog:

    Using regular expressions to locate controls in Coded UI Test

    Meanwhile according to the blog above, Anu has replied SHANMUGAVEL that we don't support this functionality using regexp unfortunately.

    Best regards


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda ZhuModerator Monday, December 17, 2012 1:23 AM
    • Unmarked as answer by chandu.k Monday, December 17, 2012 11:39 AM
    • Marked as answer by chandu.k Monday, December 17, 2012 11:39 AM
    Thursday, December 13, 2012 7:23 AM
    Moderator
  • Hello Chandu.K,

    I am marking my reply as answer. If my suggestion can’t help you, you can come back and unmark it as answer. If you have anything unclear, please feel free to come back and ask me.

    Best reagrds,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, December 17, 2012 1:23 AM
    Moderator
  • Hello Amanda,

    Thank you for the answer, it is working fine

    Thanks,

    Chandu

    Monday, December 17, 2012 11:40 AM
  • Hi Amanda,

    Is this 'Contains' operator works only for controls and not for top level windows?

    I am using CodedUI for automation on Dynamics AX (ERP from MS). I havebeen using Contains operator in finding top level windows (as titles keep chaning) . But lately, I realized that 'Contains' opearator is NOT at all working (when we started running tests on a differnt machine, than the one recorded...test started to fail!)

    I double checked this behaviour. Playback engine was completely dependant on titles and not the 'Name' property of the window. When I added the new title (on which tests were failing), playback engien started finding the controls.

    But adding titles should not be an ideal solution here. We want to make a generic library which can be used accross diffent machines using differnt data (titles dependant on data).

    Is there any setting or configuration to tell the engine to 'respect' the 'Contains' operator?

    BTW, I am using VS 2010 version.

    Thanks, Praveen

    Wednesday, December 19, 2012 7:39 AM