Monday, August 13, 2012

Descriptive Programming (DP) in QTP


                         Descriptive Programming in QTP will be write in the case of the objects are not present in the Object Repository (OR), This method of programming reduces the time for automation testers in the time of CR in the project, Reduces the storage of space as compared to storage of objects, also avoids the modification of objects in the object repository.

There are two types of Programming in DP:

1. Static programming
2. Dynamic Programming

Static Programming:
 
 Syntax:

Window("Property1:=Value1","Property2:=Value2").Object("Property1:=Value1","Property2:=Value2"). Operation

The above syntax is the sample for static programming in qtp and below are the some of the Properties and Test Objects that we used in static method.




Web:

ClassName --> Micclass
Name --> WebEdit, Browser, Link, Image, WebCheckBox, webRadioGroup
URL --> Link, Image
href --> Link, Image

HWND:

alt --> Image
FileName --> WebCheckBox, WebRadioGroup, Image
Selection --> WebRadioGroup
Height
Width
x
y
abs_x
abs_y
Class --> WebElement
title --> page

Below i written a sample script for Yahoo login in static method:

Browser("Name:=Yahoo! Mail: The best web-based email!").Page("title:=Yahoo! Mail: The best web-based email!").WebEdit("Name:=login").Set"username"
Browser("Name:=Yahoo! Mail: The best web-based email!").Page("title:=Yahoo! Mail: The best web-based email!").WebEdit("Name:=Passwd").Set"passwd"
Browser("Name:=Yahoo! Mail: The best web-based email!").Page("title:=Yahoo! Mail: The best web-based email!").WebCheckBox("Name:=.persistent").Set"ON"
Browser("Name:=Yahoo! Mail: The best web-based email!").Page("title:=Yahoo! Mail: The best web-based email!").WebButton("Name:=Sign In").Click

Dynamic Programming:

Syntax:

1. SetObjname=Description.Create
2. ObjName("Prperty Name").Value=Property Value

Below i written a sample script for Google Search the keyword (QTP) in Dynamic method, save the below script as (filename.vbs) in any path in the Desktop:


Set Brw=Description.Create
Brw("Name").value="Google"
Set Pge=Description.Create
Pge("Title").value="Google"
Set txt=Description.Create
txt("Name").value="q"
Set btn=Description.Create
btn("Name").value="QTP"

Save the above script (filename.vbs) in any path in the Desktop:

Execute file "file.vbs"
Browser(brw).Page(pge).WebEdit(q).Set"Search"
Browser(brw).Page(pge).WebButton(btn).Click
Set brw=nothing
Set pge=nothing

While executing the above scripts in QTP (Execute file "file.vbs") script will refer the main script stored in the desktop as vbs file, the saved file can be use as a reusable framework and can be modify the objects as per the project business requirements when it's needed.

Below i written a sample scripts for (default available in QTP) Flight Reservation windows application in Dynamic method, save the below script as (flight.vbs) in any path in the Desktop:

Set lgn=Description.Create
lgn("text").value="Login"
Set uname=Description.Create
uname("attached text").value="Agent Name:"
Set pwd=Description.Create
pwd("attached text").value="Password:"
Set btn=Description.Create
btn("text").value="OK"
Set fr=Description.Create
fr("text").value="Flight Reservation"
Set dof=Description.Create
dof("attached text").value="Date of Flight:"
dof("nativeclass").value="MSMaskWndClass"
Set flyfrm=Description.Create
flyfrm("attached text").value="Fly From:"
Set flyto=Description.Create
flyto("attached text").value="Fly To:"
Set btn1=Description.Create
btn1("text").value="FLIGHT"
Set ft=Description.Create
ft("text").value="Flights Table"
Set list=Description.Create
list("attached text").value="From"
list("window id").value=2001
Set edit=Description.Create
edit("window id").value="1014"
Set radio=Description.Create()
radio("text").value="Business"
radio("regexpwndtitle").value="Business"
radio("windowstyle").value="1342177289"
Set orderbtn=Description.Create()
orderbtn("micclass").value="WinButton"
orderbtn("regexpwndtitle").value="&Insert Order"
Set updateorder=Description.Create()
updateorder("regexpwndtitle").value="&Update Order"

Save the above script (flight.vbs) in any path in the Desktop:


Executefile"C:\Documents and Settings\Bhaskar\Desktop\flight.vbs"
Dialog(lgn).winedit(uname).Set"admin"
Dialog(lgn).winedit(pwd).Set"mercury"
Dialog(lgn).winbutton(btn).Click
Window(fr).winobject(dof).type"08/24/12"
Window(fr).wincombobox(flyfrm).Select(1)
Window(fr).wincombobox(flyto).Select(2)
Window(fr).winbutton(btn1).Click
Window(fr).Dialog(ft).winlist(list).Select(2)
Window(fr).Dialog(ft).Winbutton(btn).Click
Window(fr).WinEdit(edit).Set"Antony"
WIndow(fr).WinRadioButton(radio).Set
Window(fr).WinButton(orderbtn).Click
Window(fr).WinButton(updateorder).Click

While executing the above scripts in QTP (Execute file "flight.vbs") script will refer the main script stored in the desktop as vbs file,

88 comments:

  1. While running the script i am getting Error.
    Even copy and paste into the QTP i am getting error
    Can u plz Help me

    Thanks in Advance

    ReplyDelete
  2. where do we need to save the script . do we need to save this code in notepad and save it as vbs ?

    i am unable to run the script , please help me out

    ReplyDelete
    Replies
    1. Browser(brw).Page(pge).WebEdit(q).Set"Search" > should be
      Browser(brw).Page(pge).WebEdit(txt).Set"Search"

      Delete
  3. execute the following script :
    Set lgn=Description.Create
    lgn("text").value="Login"
    Set uname=Description.Create
    uname("attached text").value="Agent Name:"
    Set pwd=Description.Create
    pwd("attached text").value="Password:"
    Set btn=Description.Create
    btn("text").value="OK"
    Set fr=Description.Create
    fr("text").value="Flight Reservation"
    Set dof=Description.Create
    dof("progid").value="MSMask.MaskEdBox.1"
    Set flyfrm=Description.Create
    flyfrm("attached text").value="Fly From:"
    Set flyto=Description.Create
    flyto("attached text").value="Fly To:"
    Set btn1=Description.Create
    btn1("text").value="FLIGHT"
    Set ft=Description.Create
    ft("text").value="Flights Table"
    Set list=Description.Create
    list("attached text").value="From"
    list("window id").value=2001
    Set edit=Description.Create
    edit("window id").value="1014"
    Set radio=Description.Create
    radio("text").value="Business"
    Set orderbtn=Description.Create
    orderbtn("text").value="&Insert Order"
    invokeapplication"C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
    Dialog(lgn).winedit(uname).Set"anuj"
    Dialog(lgn).winedit(pwd).Set"mercury"
    Dialog(lgn).winbutton(btn).Click
    window(fr).Activate
    window(fr).ActiveX(dof).Type "12/12/14"
    Window(fr).wincombobox(flyfrm).Select "Denver"'or (1)
    Window(fr).wincombobox(flyto).Select "London"'or(3)
    Window(fr).winbutton(btn1).Click
    Window(fr).Dialog(ft).winlist(list).Select(2)
    Window(fr).Dialog(ft).Winbutton(btn).Click
    Window(fr).WinEdit(edit).Set"sinha"
    WIndow(fr).WinRadioButton(radio).Set
    Window(fr).WinButton(orderbtn).Click







    ReplyDelete
  4. Can you please correct me how to write code for date field for flight reservation:



    Dim oDialog, oUNEdit, oPdEdit, oOKBtn, oFRWindow, dof

    Set oDialog = Description.Create
    oDialog("micclass").Value="Dialog"
    oDialog("text").Value = "Login"

    Set oUNEdit = Description.Create
    oUNEdit("micclass").Value = "WinEdit"
    oUNEdit("attached text").Value = "Agent Name:"

    Set oPdEdit = Description.Create
    oPdEdit("micclass").Value = "WinEdit"
    oPdEdit("attached text").Value = "Password:"

    Set oOKBtn = Description.Create
    oOKBtn("micclass").Value = "WinButton"
    oOKBtn("regexpwndtitle").value = "OK"
    oOKBtn("text").Value = "OK"

    Set oFR = Description.Create
    oFR("micclass").Value = "Window"
    oFR("regexpwndtitle").Value = "Flight Reservation"
    oFR("text").Value = "Flight Reservation"


    Set dof = Description.Create
    dof("micclass").Value = "winobject"
    dof("attached text").value="Date of Flight:"
    dof("window id").Value="0"

    SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
    Dialog(oDialog).WinEdit(oUNEdit).Set "Ravi"
    Dialog(oDialog).WinEdit(oPdEdit).Set "mercury"
    Dialog(oDialog).WinButton(oOKBtn).Click
    wait 3
    Window(oFR).Activate
    Window(oFR).winobject(dof).Type "05/10/14"
    wait 3
    Dialog(oDialog).Window(oFRWindow).Close



    I have tried all possible ways but still it showing below error:

    Cannot identify the object "[ WinObject ]" (of class winobject). Verify that this object's properties match an object currently displayed in your application.

    Line (47): "Window(oFR).winobject(dof).Type "05/10/14"".

    Tip: If the objects in your application have changed, the Maintenance Run Mode can
    help you identify and update your steps and/or the objects in your repository.


    Please correct the error

    ReplyDelete
  5. Hi, I wish to be a regular contributor of your blog. I have read your blog. Your information is really useful for beginner. I did QTP Training in Chennai at Fita training and placement academy which offer best Selenium Training in Chennai with years of experienced professionals. This is really useful for me to make a bright career.

    ReplyDelete
  6. Awesome blog. I got impressed really. Just can’t imagine your tech. Your notice point is very clear and can be short little more. I need the elaborated story of your mentioning.

    Java training in Chennai | Android training in chennai | IOS training in chennai

    ReplyDelete
  7. Nice article i was really impressed by seeing this article, it was very interesting and it is very useful for Learners..
    Android Training in chennai | Android Training chennai | Android course in chennai | Android course chennai

    ReplyDelete
  8. I have read your blog and i got a very useful and knowledgeable information from your blog. its really a very nice article.You have done a great job .

    Regards......

    Cloud Computing Training Centers in Chennai

    ReplyDelete
  9. There are lots of information about latest technology and how to get trained in them, like Hadoop Training in Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies Hadoop Training in Chennai
    By the way you are running a great blog. Thanks for sharing this blogs..

    ReplyDelete
  10. Oracle Training in chennai
    Wonderful blog.. Thanks for sharing informative blog.. its very useful to me..

    ReplyDelete
  11. Oracle Training in chennai
    I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly..

    ReplyDelete
  12. Hybernet is a framework Tool. If you are interested in hybernet training, our real time working.
    Hibernate Training in Chennai,hibernate training in Chennai

    ReplyDelete

  13. hai you have to learned to lot of information about c# .net Gain the knowledge and hands-on experience you need to successfully design, build and deploy applications with c#.net.
    C-Net-training-in-chennai

    ReplyDelete
  14. Hai if our training additional way as (IT) trained as individual,you will be able to understand other applications more quickly and continue to build your skll set
    which will assist you in getting hi-tech industry jobs as possible in future courese of action..
    visit this blog webMethods-training in chennai

    ReplyDelete
  15. great article!!!!!This is very importent information for us.I like all content and information.I have read it.You know more about this please visit again.
    QTP Training in Chennai

    ReplyDelete
  16. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.
    Informatica Training in Chennai

    ReplyDelete
  17. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
    informatica training in chennai

    ReplyDelete
  18. It is really very helpful for us and I have gathered some important information from this blog.
    Best Oracle Training in Chennai

    ReplyDelete
  19. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    Hadoop Training In Chennai

    ReplyDelete
  20. It is really a great work and the way in which u r sharing the knowledge is excellent.Thanks for helping me to understand basic concepts. As a beginner in software testing your post help me a lot.Thanks for your informative article. software testing Training institute in chennai | software testing Training in chennai

    ReplyDelete
  21. I read this post two times, I like it so much, please try to keep posting & Let me introduce other material that may be good for our community.
    python training in chennai | python training in bangalore

    python online training | python training in pune

    python training in chennai | python training in bangalore

    ReplyDelete
  22. I appreciate that you produced this wonderful article to help us get more knowledge about this topic. I know, it is not an easy task to write such a big article in one day, I've tried that and I've failed. But, here you are, trying the big task and finishing it off and getting good comments and ratings. That is one hell of a job done!
    java training in chennai | java training in bangalore

    java online training | java training in pune

    java training in chennai | java training in bangalore

    ReplyDelete
  23. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
    Data Science Training in Chennai
    Data science training in bangalore
    Data science online training
    Data science training in pune
    Data science training in kalyan nagar
    selenium training in chennai

    ReplyDelete
  24. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    rpa training in Chennai | rpa training in pune

    rpa training in tambaram | rpa training in sholinganallur

    rpa training in Chennai | rpa training in velachery

    rpa online training | rpa training in bangalore

    ReplyDelete
  25. I love the blog. Great post. It is very true, people must learn how to learn before they can learn. lol i know it sounds funny but its very true. . .
    python training in tambaram
    python training in annanagar
    python training in Bangalore

    ReplyDelete
  26. QTP training in bangalore,QTP training in Bangalore offered by Training in Bangalore with 100% placement assistance. Best QTP training in Bangalore with certified experts
    qtp training in bangalore

    ReplyDelete
  27. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.

    Best Selenium Training in Chennai | Selenium Training Institute in Chennai | Besant Technologies

    Selenium Training in Bangalore | Best Selenium Training in Bangalore

    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    ReplyDelete
  28. myTectra offers Machine Learning Training in Bangalore using Class Room. myTectra offers Live Online Machine LearningTraining Globally.

    Devops is not a Tool.Devops Is a Practice, Methodology, Culture or process used in an Organization or Company for fast collaboration, integration and communication between Development and Operational Teams.

    corporate training in chennai | corporate training companies in mumbai

    ReplyDelete
  29. This is such a good post. One of the best posts that I\'ve read in my whole life. I am so happy that you chose this day to give me this. Please, continue to give me such valuable posts. Cheers!
    Data Science training in rajaji nagar | Data Science Training in Bangalore | Data Science with Python training in chennai

    Data Science training in electronic city | Data Science training in USA

    Data science training in pune | Data science training in kalyan nagar

    ReplyDelete
  30. Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up. 
    Java training in Chennai | Java training in Bangalore

    Java online training | Java training in Pune

    ReplyDelete
  31. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
    online Python training | python training in chennai

    ReplyDelete
  32. The young boys ended up stimulated to read through them and now have unquestionably been having fun with these things.
    nebosh course in chennai

    ReplyDelete
  33. Pleasant Tips..Thanks for Sharing….We keep up hands on approach at work and in the workplace, keeping our business pragmatic, which recommends we can help you with your tree clearing and pruning in an invaluable and fit way.
    angularjs Training in bangalore

    angularjs Training in bangalore

    angularjs Training in chennai

    automation anywhere online Training

    angularjs interview questions and answers

    ReplyDelete
  34. emails with the same comment. Is there any way you can remove people from that service? Thanks.
    iosh course in chennai

    ReplyDelete
  35. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
    Microsoft Azure online training
    Selenium online training
    Java online training
    uipath online training
    Python online training

    ReplyDelete
  36. by solving every issue you face with the software. Give us a call at QuickBooks Support Number to avail the greatest customer service services designed for you.

    ReplyDelete
  37. Enterprise Support telephone number is successfully delivering the entire world class technical assistance for QuickBooks Enterprise Tech Support Number at comfort of your house. We understand your growing business need and that is the reason why we provide just the best. We make sure to give worth of each and every penny by providing the consumer friendly technical support services.

    ReplyDelete
  38. Maybe you have trapped into a problem with Intuit product and payroll services? You might be ready to know the best approach to contact the client support team by dialing QuickBooks Payroll Support Number. AccountWizy welcome you 24*7 to gain access to the many support services of Intuit products asking for QuickBooks enhanced payroll support.

    ReplyDelete
  39. As well as with this particular, our Intuit QuickBooks Phone Number has much knowledge and information regarding QuickBooks tools such as QuickBooks database server manager and so many more. Many users always think about QuickBooks journal entry that just how to easily create.

    ReplyDelete
  40. The QuickBooks Payroll has many awesome features that are good enough when it comes to small and middle sized business. QuickBooks Payroll also offers a dedicated accounting package which include specialized features for accountants also. You can certainly all from the QuickBooks Payroll Support Contact Number to find out more details. Let’s see many of the options that come with QuickBooks that features made the QuickBooks payroll service exremely popular.

    ReplyDelete
  41. But, being a regular business person, working on professional accounting software, like QuickBooks Tech Support Number, is clearly definitely not easy. Thus, users may have to face a range of issues and error messages when using the software.

    ReplyDelete
  42. QuickBooks Enterprise technical support enables you to manage your business operations by getting you the most recent versions of QuickBooks Enterprise like QuickBooks Enterprise 2019. Just dial QuickBooks Enterprise Support Number US to learn the pros and cons of accounting software with the aid of our QuickBooks tech support members.

    ReplyDelete
  43. QuickBooks Enterprise Is Obviously One Probably The Most Consistent Enterprise Software, Its Recent Version QuickBooks Enterprise 2018. It's possible That After You Are Using QuickBooks And Encounter Some Errors Then Try Not To Hyper Because QuickBooks Enterprise Support Team Is Available Few Steps Far From You.

    ReplyDelete
  44. The group deployed at the final outcome of QuickBooks Support telephone number takes great good care of most from the issues of the software. QuickBooks Technical Support Number have a group of experts that might be pro in handling almost all of the issues as a result of this incredible software.

    ReplyDelete
  45. Give a call at QuickBooks Tech Support Phone Number if you are encountering any difficulties which are mentioned above. If you are facing some other problems with your QuickBooks, you'll be able to also make instant calls. Your queries are certain to get resolved without the delays.

    ReplyDelete
  46. it offers paid into the employees in a time period. First and foremost could be the tax calculations must be correct and according to the federal and state law. Our QuickBooks Support Number will surely show you in dealing with all of this.

    ReplyDelete
  47. QuickBooks Helpline provides comprehensive support for QuickBooks Support Number
    , Point of Sales and Company data file services. Company file Data Damage can happen because of surge or power failures while performing data transactions or malicious attack on the pc has affected the application while using the company file.

    ReplyDelete
  48. Would you like to Update QuickBooks Pro? We now have managed to ensure it is simple for your needs at QuickBooks Tech Support Number.It will always be simpler to concentrate on updated version as it helps you incorporate all the latest features in your software and assists you undergo your task uninterrupted. You will find simple steps that you need to follow.

    ReplyDelete
  49. QuickBooks Tech Support Numberis a simple, user friendly and powerful solution that solves the everyday small-business accounting needs like inventory part tracking, collecting and paying sales tax, time and mileage tracking, job costing and buy orders and items receipt etc.

    ReplyDelete
  50. Facing a concern won’t be a pain anymore if you have quick assistance at QuickBooks Pro Problems are inevitable and so they will not come with a bang. Our team at QuickBooks Tech Support Phone Number is ready beforehand to deliver you customer-friendly assistance if you talk to an issue using QuickBooks Pro.

    ReplyDelete
  51. It is possible to dial the QuicKbooks Tech Support Phone Number to possess a spoken language because of the QuickBooks Specialists or else you can even talk to them by victimization the chat choice on our internet site.

    ReplyDelete
  52. Is composed of a beautiful bunch of accounting versions, viz., QuickBooks Pro, QuickBooks Premier, QuickBooks Enterprise, QuickBooks POS, QuickBooks Mac, QuickBooks Windows, and QuickBooks Payroll, QuickBooks is now a dependable accounting software that you could tailor depending on your industry prerequisite. Along with it, our QuickBooks Technical Support Number will bring in dedicated and diligent back-end helps for you personally for in case you find any inconveniences in operating any of these versions.

    ReplyDelete
  53. Search towards the chart of accounts is simple to manage with added search bar right within the chart of accounts. For better information, you can call at QuickBooks Enterprise Tech Support Phone Number.

    ReplyDelete
  54. We make sure your calls don't get bounced. If the calls are failing to connect to us at QuickBooks Tech Support Number. you'll be able to also join our team by dropping a message without feeling shy. Our customer care support will remain available even in the wee hours.

    ReplyDelete
  55. QuickBooks Payroll Technical Support Phone Number software helps you to ready your invoices, manage your organization payrolls, track your online business inventory, control cash flow, and become tax-ready.

    ReplyDelete
  56. Hawk-eye on expenses: You can easily set a parameter to a specific expense. This parameter could be learned, especially, from our best QuickBooks Tech Support experts.

    ReplyDelete
  57. This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points. To appreciate this I like to share some useful information.Oracle Apps SCM Training in Bangalore

    ReplyDelete
  58. If the problem hasn’t been resolved even after clearing “cache’, you can try “Disconnecting and then reconnecting” the feed. If you would like to learn How To Fix Quickbooks Error 9999, you can continue reading this blog.

    ReplyDelete

  59. This was a very informative article, indeed loved to read and clear my doubts. Keep us posted a lot more blogs. Also check out our blog pages too.

    data science training in chennai

    ccna training in chennai

    iot training in chennai

    cyber security training in chennai

    ethical hacking training in chennai

    ReplyDelete
  60. Kim Ravida is a lifestyle and business coach who helps women in business take powerful money actions and make solid, productiveIamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder IamLinkfeeder

    ReplyDelete
  61. You can give the right data to the helpful crowd by utilizing Data Categories include inside Salesforce Knowledge. Suggest me a Salesforce courses in Noida

    ReplyDelete
  62. Sign up now and participate in our demonstration sessions for Python Course in Hyderabad by AI Patasala and nurture your career with this platform.
    Python Training Hyderabad

    ReplyDelete
  63. Thanks for sharing this incredible article.

    Please give your review on Penial

    ReplyDelete
  64. There are also varieties of options available to choose a career in data science, like you can become a data scientist, developer, data engineer, analyst, database administrator, and many more.

    data science training in patna

    ReplyDelete
  65. List experience act score range large. Resource kitchen rather like general rise.career-news

    ReplyDelete
  66. Owner least cell final. Attorney push offer break fight close require. Music wait PM food movie. Operation knowledge clear lead.

    ReplyDelete