Facebook

Course Name Start Date Time Duration Registration Link
No Training Programs Scheduled ClickHere to Contact
Please mail To sudhakar@qtpsudhakar.com to Register for any training

Wednesday, April 22, 2009

QTP Scripting Sample Questions

QTP Scripting (100 Examples)
Try to find solutions for these Question. I will add solutions for these questions later.
1 Write a program to find the x and y coordinates of a button
2 Write a program to Read items in a list box
3 Write a program to Read items on a desktop
4 Write a program to Capture Desktop Screen shot
5 Write a program to Read tab names from a tabbed window
6 Write a program to Check whether scrollbars exists inside a editor
7 Write a program to check whether edit box is enabled or writable
8 Write a program to Check whether dialog is middle of the window
9 Write a program to Check whether country contains all the states
10 Write a program to Check whether edit box is focused
11 Write a program to Check default selection in a list box
12 Write a program to Capture webbutton image
13 Write a program to List all links in the web page
14 Write a program to Check whether given link exists or not
15 Write a program to Find image width and Height
16 Write a program to Print URL displayed in the address bar
17 Write a program to Check whether webpage downloaded completely
18 Write a program to Refresh a web page
19 Write a program to Verify page title is displayed correctly
20 Write a program to Verify whether page contains frames
21 Write a program to Find page load time
22 Write a program to Check given text is displayed on the web page
23 Write a program to Find whether image contains tool tip
24 Write a program to Invoke the Browser with specified URL
25 Write a program to Import an excel file to a Data table
26 Write a program to Read data from first parameter of Global sheet
27 Write a program to Read data from all sheets and all parameters of the excel file
28 Write a program to place data in a specific sheet in the excel file
29 Write a program to Import data to data table from a database
30 Write a program to Read and display data from CSV file
31 Write a program to Find number of rows and columns in a web table
32 Write a program to Display entire data in the web table
33 Write a program to Display all images in the webpage
34 Write a program to Check whether table contains headers
35 Write a program to Find the background colour of a webobject
36 Write a program to Print results in a HTML format
37 Write a program to Select different radio buttons for different script iterations
38 Write a program to Read all the items from a services window
39 Write a program to Find screen resolution
40 Write function to compare two bitmaps
41 Write a program to Add and Remove Repositories to the action
42 Write a program to Load Library files
43 Write a program to Enable and Disable Recovery scenarios programmatically
44 Write a program to Report Results status to Results file
45 Write a program to Find the active window name
46 Write a program to List out the windows that are open
47 Write a program to Call reusable actions from different script
48 Write your own standard checkpoint
49 Write your own synchronization function
50 Write a program to Read menu names
51 Write a program to Read menu items
52 Write a program to Check whether a check button is selected or not
53 Write a program to Check whether we can select multiple items in the listbox
54 Write a program to Check whether edit box allows exactly 15 characters
55 Write a program to Check whether items in the page are aligned properly
56 Write a program to Check whether data in the webtable is left aligned
57 Write a program to Find which add-ins are loaded.
58 Write a program to Find available add-ins in the tool
59 Write a program to Change window title
60 Write a program to Find whether specified window is there on the desktop
61 Write a program to Check whether a window is in minimized or maximized
62 Write a program to Check window is resizable
63 Write a program to Read all elements in the XML file
64 Write a program to Read attributes of a particular element in the XML file
65 Write a program to Modify attribute value
66 Write a program to Display complete contents of an XML file
67 Write a program to Find font type.
68 Write a program to Find Font size
69 Write a program to Check whether text is bold and underlined
70 Write a program to Find the memory utilized by a process
71 Write a program to Verify flash image
72 Write a program to Check pointed link is having different back ground colour?
73 Write a program to Retrieve Action Parameters
74 Write a program to Disable active screen programmatically
75 Write a program to Modify Mandatory and Assistive properties programmatically
76 Write a program to Configure Run options programmatically
77 Write a program to Define test results location through program
78 Write a program to Disable Run settings
79 Write a program to Read and Update data from user defined environmental variable
80 Write a program to Configure maximum timeout value for web page to load
81 Write a program to read and delete cookies
82 Write a program to Verify whether status indicator is moving as the movie is playing
83 Write a program to Clear the cache in the webpage
84 Write a program to Check whether webpage is loaded from server or from cache
85 Write a program to Configure web options programmatically
86 Write a program to Check whether new items can be added to a listbox
87 Write a program to Check whether link s pointing to correct URL
88 Write a program to invoke the application
89 Write a program to Read parameters in the data table
90 Write a program to List out the windows that are minimized
91 Write a program to add environmental variables during run time
92 Write a program to check whether tab order is left to right and top to bottom
93 Write a program to find the maximum text length that can be entered in a edit box
94 Write a program to verify min and max length constraints of text in an edit box
95 Write a program to find the kind of data edit box accepts
96 Write a program to add objects to object repository file
97 Write a program to export object repository file to XML
98 Write a program to check whether a column in the database table is a primary key
99 Write a program to display constraints of a column in the database table
100 Write a program to print all button object names in a page

12 comments :

  1. Q1: Write a program to find the x and y coordinates of a button

    Ans:
    varBrowser="name:=Google.*"
    varPage="title:=Google.*"
    If Browser(varBrowser).Page(varPage).Exist Then
    Browser(varBrowser).Close
    End If
    systemUtil.Run "iexplore.exe","www.google.com"
    Set wbButton=description.Create()
    wbButton("micClass").value="WebButton"
    wbButton("name").value="Google Search"
    wbButton("html tag").value="INPUT"
    xCord=Browser(varBrowser).Page(varPage).WebButton(wbButton).GetROProperty("x")
    yCord=Browser(varBrowser).Page(varPage).WebButton(wbButton).GetROProperty("y")
    msgbox "x coordinate="&xCord&" and y coordinate="&yCord

    ReplyDelete
    Replies
    1. wbButton("html tag").value="INPUT"

      instead of "INPUT" u just keep "BUTTON"(in my laptop it is showing like "BUTTON".. ur script is absolutely correct... successfully excecuted)

      BY using object spy u can see the value of html tag

      Delete
  2. maya said
    itemsshow=Browser("Register: Mercury Tours").Page("Register: Mercury Tours").WebList("country").GetROProperty("all items")
    msgbox itemsshow

    ReplyDelete
  3. Click here to see 50 Basic VB Script Questions and Answers
    Click Here to see 100 Advanced VBScript Sample
    ===========================================================
    when i click on the above link it is navigating me to the wordpress ..

    HOW CAN I GET THOSE BASIC 50 SCRIPT AND 100 ADVANCED VBSCRIPT SAMPLES

    ReplyDelete
  4. Hi Sudhakar,

    The links provided at the top of this article are dead now and displaying error "This Windows Live Space is no longer available"
    Could you please provide any alternate link for these.

    ReplyDelete
  5. Q3 Anser:
    Set ObjDesk=Description.Create
    ObjDesk("Micclass").value="Dialog"
    Set Chilitm=Deskto.Chaildobjects(ObjDesk)
    Msgbox "Chilitm"

    ReplyDelete
    Replies
    1. Execute this and findout where you have done the mistake

      Delete
  6. Hi sudhakar

    I Have one question.How to pass multiple value using environment variable.while i am executing it is taking only single value????Plz tell me by Taking any login Scenario.

    ReplyDelete
  7. hi sudhakar

    please verify the link for 50 vb and 100 vb advance

    its dead
    help me out

    ReplyDelete
  8. Hai Sudhakar,

    How to list out the no of minimized window.....?

    Please help me out..!

    ReplyDelete
  9. Hi Sudhakar,
    Goodmorning and First of all Thank you very much for posting valuable questions. when im trying to download advanced 100 vbscript questions its asking me to login into word press, then i have registered but finally i dint found any information related to vbscript. Could please provide the answer for Click here to see 50 Basic VB Script Questions and Answers
    Click Here to see 100 Advanced VBScript Sample

    at least in your blog so that i can learn.

    Thanks
    Viswanadh
    viswareddy6969@gmail.com

    ReplyDelete
  10. How to click Dynamically changing links in Webtabe?

    ReplyDelete