1. How to Open an existing word file
Steps:
Create object using word
application
Make the object visible
Open a new word file with help of
open method
2 - How to launch a
QTP application, open a new test and close QTP through a
script.
Steps:
Declaring the application
object variable
Creating the object
for qtp application
Invoke the qtp by
using launch method
Open new test with
help of qtp application object
Make qtp application
applicable
Relesing the qtp app
object
3 - How to get data
from Excel into QTP without importing the Excel.
Steps:
Assign the path of excelfile to
variable
Assign the 1 to row,column variables
Declare the function for excel by
passing the path,sheet,row,column
Create an object of excel
Open the path of excel file by
using workbooks object
Assign the sheet data to variable
Closing the excel object
Relese the excel object
Close the function
Using msgbox for viewing the variables
4 - How to launch
QTP, open a test, run it and close QTP.
Steps:
Declaring the two variables
Create an object for using
quicktest.application.
Invoke the qtp by using launch
method
Open the desired test by using open
method
Assign the qtptest to an variable
Execute the test by using run
method
Close the test by using close
method
Close the qtp by using quit method
5.How to Open a new word file
Steps:
Create object using word
application
Make the object visible
Open a new word file with help of
add method
6 - How to import
excel into datatable in QTP.
Steps:
Declare the application object
variable
Create the application object
Launch the qtp
Open the test
Import the excel sheet data to
first sheet of data table
Export the runtime datatable to
excel sheet
Specify the qtp object visible
Relese the application object
7 - How to run all
tests in a specific folder in QuickTest professional (QTP)?
Steps:
Declare the variables for qtpobj,fsoobj,dir,testcollection
Create an object using filesysytemobject
Use the getfolder to returs a folder
Assign the subfolders to testcollcetion variable
Create the object using reunresultsoptions
Setting the location for the run
results
Execute the test. Instruct
QuickTest Professional to wait for the test to finish executing
Close the qtp by using close method
Relese the application
object,runresults object
8 - How to count and
get the path & name of all the object repositories associated with an
action ?
Declare the application object
variable
Create the application object
Launch the qtp
Open the test
Retrive the object repositaries of
collection of action1
Count the no of object repositary
files in the collection
Returns the path of object
repossitary file
Extract the obkect repositary file
name
Getting the whole path in variable
Returh the specified no of chars
Relese the repositorys object ,
application object, testobject.
9 - How to count
total number of links on a web page?
Steps:
Create object using description
object
Assign link to object using value
method
Retrive the collection of all
objects & assign to variable
Using msgbox function dispay the
data present in variable
10 - How to get link
names and URLs for all the links on a web page?
Steps:
Create object using description
object
Assign link to object using value
method
Using child objects assign to variable
Assigning the data to variable by
using child objects
Count the links by using the count
function
Use for loop for repeting no of
links
Use getroproperty for capturing the name & url
11 - How to run
multiple tests in QuickTest professional (QTP) ?
Steps:
Declare the application object variable
Create the application object
Launch the qtp
Declare the array
Put the multiple
tests in array
Create the results
run object
Open the tests
Assign the tests to
variables
Execute the test by
using run method
Close the qtp using
close method
Relese the
application object, teset object
12 How to compare two XML files.
Steps:
Assign the xml file to variable
Load the first xml file
Assign the xml file to variable
Load the second xml file
Compare the xml files by using
compare method and assigning result to variable
If the result variable is having value 1 then document same otherwise
not match
13. How to open a new word document and writing text to
it and saving it
Steps:
Create object using word application
Make the object visible
Open a new word file with help of
add method
Assign the word selection to
variable
Write the text by using
14.How to Print a
word file
Steps:
Create object using word application
Open the desired document by using open method
Print the document by using printout method
Close the word document
15 - How Can I Add
Additional Worksheets to an Excel Workbook?
Steps:
Create an object for excel
application
Assign the visible property as true
Adding a sheet by using
workbooks.add method & assigning to variable
Assigning sheet to variable
Adding to the excelsheet
16 - How Can I Insert
a Column into a Spreadsheet?
Here's a script that writes a column header to columns A, B,
and C, then inserts a new, blank column between columns B and C:
Steps:
Create an object for excel application
Assign the visible property as true
Assign the worksheet using workbooks object
Assign the data to
cells using work sheet methods
Using insert method insert data by specifying
Const xlShiftToRight = -4161
17 - How Can I
Replace Text in an Excel Spreadsheet?
Steps:
Create an object for excel application
Assign the visible property as true
Assign the excel file to the variable by using workbooks
& open function
Focus on particular sheet by using workbook object
With the help of replace method we can replace the text
18 – How to Open an
Excel Spreadsheet
Steps:
Declare the variables
Create the object using excel
application
Assign the excel file to the
variable by using workbooks & open function
No comments:
Post a Comment