SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    use of RunScript method

    QTP11.0 has added new method RunScript() under page object of web addin. I could not understand where we'll get to use this method during automation.
    If any of you have any idea about the need of running scripts on web pages, please share it.

  2. #2
    Member
    Join Date
    Dec 2010
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: use of RunScript method

    From the QTP help on the RunScript Method:

    "If the script you run returns a JavaScript array, you cannot use standard VBScript syntax to access the array index (for example, arr(0) ) nor can use use JavaScript syntax (for example arr[0]).



    You can use JavaScript operations such as pop, push, shift or length to access JavaScript array items. Keep in mind, however, that most such JavaScript array operations also modify the content of the array. Therefore, you may want to consider cloning the array and using these operations on the cloned copy. (See example below.)



    Sub RunScript_Example()

    'This example uses the RunScript method to remove a DOM element from a frame.

    'Then it verifies that the frame still behaves correctly when the DOM element is removed.



    Browser("MySearchEngine").Page("MySearchEngine").F rame("Web Search").RunScript "var remove = document.getElementById('logo'); remove.parentNode.removeChild(remove)"

    'Check that the frame behaves correctly

    If Browser("MySearchEngine").Page("MySearchEngine").F rame("Web Search").Image("MySearchEngine").Exist Then

    Reporter.ReportEvent micFail, "Failed to remove MySearchEngine logo"

    End If



    End Sub
    "

 

 

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 05:41 AM.

Copyright BetaSoft Inc.