SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Apr 2002
    Location
    India
    Posts
    55
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to pass an array to a recovery function?

    How to pass an array to a recovery function? Is it possible to do it?

  2. #2
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to pass an array to a recovery function?

    Assign array to Environment variable and access it inside recovery function.

  3. #3
    Member
    Join Date
    Apr 2002
    Location
    India
    Posts
    55
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to pass an array to a recovery function?

    When I tried to do that, getting below error:

    This array is fixed or temporarily locked: 'Environment.Value'

    Function file: C:\OnQ HU\Automation\Function\ErrorHandlingFunctions.qfl
    Line (5): "testarray = Environment.Value("ExcelArray")".

  4. #4
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to pass an array to a recovery function?

    I just tried and it worked for me.

    QTP script:
    Dim MyArray
    MyArray = Array(10,20,30)
    Environment.Value("TestArray") = MyArray 'TestArray is environment variable of type intrenal
    Browser("name:=xxxxxxxxxxxxxxxxxxxxxxxx").Sync'For cing error and recovery function called here.

    Recovery Function:
    Function RecoveryFunction1(Object, Method, Arguments, retVal)
    RecoveryArray = Environment("TestArray")
    Msgbox RecoveryArray(0)'Printing 10
    End Function

  5. #5
    Member
    Join Date
    Apr 2002
    Location
    India
    Posts
    55
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to pass an array to a recovery function?

    Your code works. It doesn't work if I do in the way below:

    QTP script:
    Dim MyArray(3)
    MyArray(0) = 10
    MyArray(1) = 20
    MyArray(2) = 30
    Environment.Value("TestArray") = MyArray
    Browser("name:=xxxxxxxxxxxxxxxxxxxxxxxx").Sync'For cing error and recovery function called here.

    Recovery Function:
    Function RecoveryFunction1(Object, Method, Arguments, retVal)
    RecoveryArray = Environment("TestArray")
    Msgbox RecoveryArray(0)'Printing 10
    End Function

  6. #6
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to pass an array to a recovery function?

    Use GlobalDictionary object as a workaround.
    Sample code here.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:17 AM.

Copyright BetaSoft Inc.