Micro Focus QTP (UFT) Forums
Script not getting title in IE - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Script not getting title in IE (/Thread-Script-not-getting-title-in-IE)



Script not getting title in IE - UFT_Newbie - 09-18-2014

Hi Guys,
I need to run my script in IE, Chrome and FF. My script works fine in Chrome and FF but not in IE. In IE, i'm getting the url of the page instead of title. Below is the code:

Code:
Browser("ABC").Page("XYZ").Link("link").Click
Title = "ABCDEFG"
Title = Browser("CreationTime:=1").GetROProperty("title")

If Title  = Title Then
    msgbox "Pass"
Else
    msgbox "Fail"
End If

Can someone help me out with this issue.


RE: Script not getting title in IE - vinod123 - 09-25-2014

Demonstration: AddUsingTitle

As stated earlier, this method will store any browser with the provided title.
Code:
SystemUtil.Run "iexplore.exe", "http://newtours.demoaut.com", "", "", 3 : Wait(4)
'Add the above open browser using its title
BrowserObject.AddUsingTitle "DemoAUT", ".*Mercury Tours.*"

SystemUtil.Run "iexplore.exe", "http://google.com", "", "", 3 : Wait(4)
'Add the above open browser using its title
BrowserObject.AddUsingTitle "Google", ".*Google.*"

'Use the names we gave the browser, and use the same name regardless of changes in its properties
With BrowserObject.Name("DemoAUT")
    .WebEdit("name:=userName").Set "test"
    .WebEdit("name:=password").Set "test"
    .Image("name:=login").Click
    .Sync

    If .WebList("name:=fromPort").Exist(10) Then
        .WebList("name:=fromPort").Select "Frankfurt"
        .WebList("name:=fromMonth").Select "December"
        .WebList("name:=toPort").Select "Paris"
        .WebList("name:=toMonth").Select "December"
        .WebRadioGroup("name:=servClass").Select "#1"
        .WebList("name:=airline").Select "Unified Airlines"
        .Image("name:=findFlights").Click
    End If
End with

'Use the names we gave the browser, and use the same name regardless of changes in its properties
With BrowserObject.Name("Google")
    .Link("text:=Gmail", "index:=0").Click
    .Link("text:=+You", "index:=0").Click
    .Link("text:=Images", "index:=0").Click
End with

With BrowserObject
    .Name("DemoAUT").Close
    .Name("Google").Close
End with

'Release
BrowserObject.Destroy