Forum Discussion

abrar22's avatar
abrar22
Frequent Contributor
10 years ago

Storing the value of property object

Hi 

 

I want to Store object Text in to variable so I can compare it later. 

 

For Example: 

 

this.strategyTypeView.SelectedItem is ABC

 

Can I store ABC in variable so i can verify it later? 

I am doing follwing but its not storing the value

 

var store=  this.strategyTypeView.SelectedItem;

 

Thanks for you help

 

2 Replies

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    hi,

     

    you may have to know in which scope you want to use your variable.

    in a procedure/function/class (etc depending your script type) you could define and assign a local variable but it won't be shared outside this scope.

     

    if you need to read it in another script, you may create in runtime project variables

  • TestComplete does have an operation available to store an object's property value.  The short video below goes over how to do this in a Keyword test.  Once that's recorded you can convert the Keyword test to script and it will show you how to do the same thing in the syntax of your Project's scripting language.

     

    Setting a variable value from on screen: http://screencast.com/t/vBL2Twwozz