Forum Discussion

sudam_SL's avatar
sudam_SL
Contributor
5 years ago

How to Store value which extract from web element and re-use it --Keyword testing

Hi,

I'm new to TestComplete tool and facing following issue while doing the pilot project. it would be highly appreciate if you can help on this matter.

Requirement : Store value (create local variable) and assign value from the web element. and after few step i need to write on that value on text box.

Tried : I tried with "Set Variable"command but i'm unable to select unique property from relevant web element as there is no any unique property than the contentText (that is the value which i need to store and it getting change during the each execution cycle)

 

Note : attached screen for the reference

 

 

 

 

  • Hi,

     

    Yes, Set Variable is the way to go.

    I would recommend to enable Advanced view in both Object Spy and Object Browser to see more properties (click the View More Members... link present on your screenshot).

    Also talk to your developers and ask them to provide stable and unique identifiers for the web elements you are going to interact with in your tests. Absence of unique and stable identifiers will result in flaky and fragile tests even if you try to use XPath. (As you might decide to try or are convinced to use by others.)

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Yes, Set Variable is the way to go.

    I would recommend to enable Advanced view in both Object Spy and Object Browser to see more properties (click the View More Members... link present on your screenshot).

    Also talk to your developers and ask them to provide stable and unique identifiers for the web elements you are going to interact with in your tests. Absence of unique and stable identifiers will result in flaky and fragile tests even if you try to use XPath. (As you might decide to try or are convinced to use by others.)