Through UFT, I need to click on the hyperlink in outlook email body

Through UFT, I need to click on the hyperlink in outlook email body.

I'm not able to do that.Could anyone help me out on this.

Parents
  • Verified Answer

    The easiest and most suitable solution would be to click on the given hyperlink in the webmail solution of Outlook.

    If that is not available, you can either try to do recording on Windows application through the option in "Run and Record Settings" in UFT and/or work with the Outlook Object Model directly. Material for the latter one can be found here, here and here and through this three-part article (Part 1, Part 2Part 3).

    Good luck!

  • thanks a lot sir...now i am able toclickon the link... "issue resolved"... :)

    Pease find the below code that i used and with which now i am able to click on the hyperlink in the mailbody

    'searching for the mail subject in outlook
    Set Emails = OutlookSetFolder.Items
    Set Notification = Emails.GetFirst
    For i = 1 to OutlookSetFolder.Items.Count
    If (Notification.Subject = "Payment Confirmation") Then
    Notification.Display
    Exit For
    End If
    Set Notification = Emails.GetNext
    Next
    'extracting the mail body along with rich text into IE browser
    sHtmlText = Notification.HTMLBody
    Set ie = CreateObject("InternetExplorer.application")
    ie.Visible = True
    ie.Navigate "about:blank"
    ie.Document.write sHTMLText
    'Fetching the link count in the page
    Set obj1 = Description.Create
    obj1("micClass").Value = "Link"

    Set obj2 = Browser("Browser").Page("Page").ChildObjects(obj1)
    linkcount = obj2.count

    'clicking on the link
    For i = 0 To linkcount-1
    urlvalue = obj2(i).getroproperty("url")
    systemutil.Run "iexplore.exe",urlvalue,"","",3
    Next

Reply
  • thanks a lot sir...now i am able toclickon the link... "issue resolved"... :)

    Pease find the below code that i used and with which now i am able to click on the hyperlink in the mailbody

    'searching for the mail subject in outlook
    Set Emails = OutlookSetFolder.Items
    Set Notification = Emails.GetFirst
    For i = 1 to OutlookSetFolder.Items.Count
    If (Notification.Subject = "Payment Confirmation") Then
    Notification.Display
    Exit For
    End If
    Set Notification = Emails.GetNext
    Next
    'extracting the mail body along with rich text into IE browser
    sHtmlText = Notification.HTMLBody
    Set ie = CreateObject("InternetExplorer.application")
    ie.Visible = True
    ie.Navigate "about:blank"
    ie.Document.write sHTMLText
    'Fetching the link count in the page
    Set obj1 = Description.Create
    obj1("micClass").Value = "Link"

    Set obj2 = Browser("Browser").Page("Page").ChildObjects(obj1)
    linkcount = obj2.count

    'clicking on the link
    For i = 0 To linkcount-1
    urlvalue = obj2(i).getroproperty("url")
    systemutil.Run "iexplore.exe",urlvalue,"","",3
    Next

Children
No Data