Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin


 One Stop Testing ForumTesting Tools @ OneStopTestingQuickTest Pro @ OneStopTesting

Message Icon Topic: How to check file extensions using QTP

Post Reply Post New Topic
Author Message
Mithi25
Senior Member
Senior Member
Avatar

Joined: 23Jun2009
Online Status: Offline
Posts: 288
Quote Mithi25 Replybullet Topic: How to check file extensions using QTP
    Posted: 22Sep2009 at 2:23am

Using QTP, we want to validate whether the particular image on a web page is .jpg, .gif, .bmp or any other extension.

Solution:

  1. We will take the example of Mercury demo application  http://newtours.demoaut.com/image
  2. The image to be checked is shown in red ellipse above.
  3. Now “Object spy” on the object. image
  4. Find the property containing filename. Usually the name of the property would be file name itself. The value for this case is featured_destination.gif.
  5. Put this value into a array using GetTO property.
  6. Now make use of split function with . (dot) as delimiter.
  7. The last value of the array would be your required file extension. Usually the 2nd value inside an array would be the file extension, but in case developer assigns the name as featured.destination.gif [Notice the two dots] then it might create a problem that’s why always take the last value of the array.

Here is the script for the process given above:

Dim filename, arrfile

'Put filename into the array

filename =  Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Featured Destination:").GetTOProperty("file name")

' Split using "." as delimiter

arrfile = split(filename,".")


Edited by Mithi25 - 22Sep2009 at 2:24am



Post Resume: Click here to Upload your Resume & Apply for Jobs

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.109 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Privacy Policy | Terms and Conditions
Job Interview Questions | Placement Papers | Free SMS | Freshers Jobs | MBA Forum | Learn SAP | Web Hosting