Results 1 to 7 of 7

Thread: Change runtime property of an object

  1. #1
    Geek_Guest
    Guest

    Change runtime property of an object

    How to change the runtime property of an object? Can anyone explain me with syntax for the same.

    Question asked by visitor Abhijith


  2. #2
    Expert Member
    Join Date
    Nov 2006
    Answers
    518

    Re: Change runtime property of an object

    Use SetTOProperty

    Eg: This example is from QTP help document.

    Window("Date").ActiveX("Calendar").SetTOProperty "ProgId", "MSCAL.Calendar.7"

    Lack of WILL POWER has caused more failure than
    lack of INTELLIGENCE or ABILITY.

    -sutnarcha-

  3. #3

    Re: Change runtime property of an object

    SetTOProperty will only change the property of the test-object, not of the run-time object.

    You can do this by using objectType().object.objectProperty="Value_of_the_Property"


  4. #4
    Junior Member
    Join Date
    Dec 2007
    Answers
    24

    Re: Change runtime property of an object

    hi anshoo..
    i have tried this...objectType().object.objectProperty="Value_of_the_Property"
    its not working....can u be in little brief with example....
    First of all runtime property....it is dynamic...what is the need of changing it....?


  5. #5
    Expert Member
    Join Date
    Oct 2007
    Answers
    375

    Re: Change runtime property of an object

    Hi Naga,

    When we wish to modify the runtime properties of an Object, we actually are trying to assign it a different property compared to what it had as a Test Object.

    Reasons could be many. Maybe the property of the Object changes during Application naviagtion. For Instance the Outer Text of a table can change during execution or completion of certain action.

    So to change the OuterText of such an Object at Runtime, we need a method. Unfortunately QTP does not have a SETROProperty method like GETROProperty. Hence we use -

    WebElement().Object.outerText = "abcd".

    WebElement here indicates the Object Type we are working with...

    Cheers...


  6. #6
    Junior Member
    Join Date
    Dec 2007
    Answers
    24

    Re: Change runtime property of an object

    Thnx.....bizzzzzare......got it ................u r explanation is crystal clear


  7. #7

    Re: Change runtime property of an object

    objectType() = This is the object at hand
    objectProperty = This is the property you want to change (Use Object Spy to view all Object's properties)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact