Showing posts with label QTP 11 Runscript method. Show all posts
Showing posts with label QTP 11 Runscript method. Show all posts

Monday, October 31, 2011

Running Javascript in QTP

You can run Javascript in QTP using Runscript method. This is a new feature in QTP 11. Here is an example for it.

Set oPage=Browser("name:=Google").Page("title:=Google")

Set oTxtGoogle=oPage.RunScript("document.getElementsByName('q')(0);")
'The above line gets DOM object for Google textbox using Javascript.

oTxtGoogle.Value="qtp"

I hope it is helpful.