QTP Descriptive Programs Headline Animator

QTP Descriptive Programs

Thursday, May 22, 2008

How to print/ locate location of a URL of a page in a Web Page?

Prerequisites: Not Required
Procedure: Paste the Below Code in QTP window and Click on Run
Code:
Dim IE ' Declares a variable
Set IE = CreateObject ("InternetExplorer.Application") ' Creates Object to Variable
IE.Visible = True ' Makes Internet Explorer as Visible
IE.Navigate "www.yahoo.com" ' Opens yahoo.com in Internet Explorer
Browser("Name:= Yahoo.*").Page("Title:=Yahoo.*").Link("Name:=Sign In").Click ' Clicks on Sign In Link on Yahoo site
wait 4 ' Waits up to 4 seconds
MsgBox IE.LocationURL ' Prints current URL of Yahoo which is Existed in IE Address Bar

No comments: