質問

私はEメール内のすべてのリンクのリストを抽出し、それらのそれぞれに対してロジックを実行する必要があるマーキュリー/ HP QuickTestの中にテスト計画のPro 9.1を、「開発」しています。

この場合、私は、Webメールを使用していますので、メッセージは、Webページとして表示されます。私は、より現実的なUXを複製するために、後にOutlookを使用したいと考えていかかわらます。

私は開発者、テスターではありませんよ。誰もがこの抽出を行いますいくつかの「コード」を私に提供することはできますか?

役に立ちましたか?

解決

あなたは、特定のタイプの子オブジェクトのコレクションを返すためにChildObjectsメソッドを呼び出すことができます。

:たとえば、Googleのホームページ上のすべてのリンクオブジェクトのリストを取得します
set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
set links = Browser("title:=Google").Page("title:=Google").ChildObjects(oDesc)
For i = 0 To links.Count-1
    reporter.ReportEvent micInfo, links(i).GetROProperty("text"), ""
Next

だから、あなただけの電子メールの本文が含まれており、検索のための親としてことを使用するWeb要素を特定する必要があります。

他のヒント

あなたは、Outlookのルートを行く終わる場合は、

、あなたはQTPのGUIコードを使用することなく、それを行うには、OutlookのAPIを使用することができます。

sServer = "your.server.address.here" '"your.server.address.here"
sMailbox = "JoeSmith" '"mailboxName"

' build the ProfileInfo string
sProfileInfo = sServer & vbLf & sMailbox

' create your session and log on    
Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, True, 0, True, sProfileInfo

' create your Inbox object and get the messages collection
Set oInbox = oSession.Inbox
Set oMessageColl = oInbox.Messages

' get the first message in the collection
Set oMessage = oMessageColl.GetFirst

If oMessage Is Nothing Then
   MsgBox "No messages found"
Else
   ' loop through inbox
   Do
     With oMessage
        ' message data:
        Debug.Print .Subject & vbCrLf & .TimeReceived & vbCrLf & .Text
        ' this triggers the clever Outlook security dialog:
        'Debug.Print .Sender(1) & vbCrLf & .Recipients(1)
        Debug.Print
     End With

     Set oMessage = oMessageColl.GetNext
   Loop Until oMessage Is Nothing
End If

'Logoff your session and cleanup
oSession.Logoff

Set oMessage = Nothing
Set oMessageColl = Nothing
Set oInbox = Nothing
Set oSession = Nothing
'write qtp script to display names of links in  jkcwebsite page
Option explicit
Dim bro,url,n,desc,childs,i
bro="c:\Program Files\Internet Explorer\IEXPLORE.EXE"
url="http://ieg.gov.in/"
invokeapplication bro&" "&url
'create description for link type
Set desc=description.Create
desc ("micclass").value="link"
'get all links in jkc page
Set childs=browser("title:=Jawahar Knowledge Center").Page("title:=Jawahar Knowledge Center").ChildObjects(desc)
For i=0 to childs.count-1 step 1
    n=childs(i).getroproperty("name")
    print n
Next
n=childs.count
browser("title:=Jawahar Knowledge Center").Close
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top