Tuesday, March 25, 2014

Run Javascript in UFT (QTP)

 Browser("Browser_Local").Page("MyPage").RunScript("$('#Hotel_overnight_to_1').val('25.03.14')"
   
    Dim oPage
    Set oPage=Browser("Browser_Local").Page("MyPage"
      Dim bisDay, bisMonth, bisYear
     
    Set bisDay=oPage.RunScript("document.getElementsByName('hotel[overnight_to][1][day]')(0);"
    bisDay.Value="25"
   
    Set bisMonth=oPage.RunScript("document.getElementsByName('hotel[overnight_to][1][month]')(0);"
    bisMonth.Value="03"
   
    Set bisYear=oPage.RunScript("document.getElementsByName('hotel[overnight_to][1][year]')(0);"
    bisYear.Value="2014"

Source:
http://qtpcodes.blogspot.de/2011/10/running-javascript-in-qtp.html

No comments:

Post a Comment