Select Page
Codoid Blog

Running Javascript in QTP

Being a leading QA Company, we write blogs on all prominent software testing topics and tools using our real-world experience. So stay sharp by subscribing to our Newsletter.

Most awaited feature for Web application automation is implemented in QTP 11.

Yes, it is Running JavaScript snippets during run-time. It is really helpful to trigger a JavaScript function which is attached to an HTML object.

Code

Dim oPage:Set 

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

oTxtGoogle=oPage.RunScript("document.getElementsByName(

'q')(0);")  
'The above line gets DOM object for Google textbox 

using Javascript.

oTxtGoogle.Value="qtp"
  

Comments(0)

Submit a Comment

Your email address will not be published.

Talk to our Experts

    Amazing clients who trust us

    image
    image
    image
    image
    image
    image