how can i get first text[1] inside a complex DIV using UFT?

98 Views Asked by At

this is the xpath of global DIV:

/html/body/div/div/div[1]/div

Pic of that DIV: enter image description here

his html :

<div class="alert alert-primary">
            <h2>How to log in:</h2>
            <strong>E-Mail:</strong> [email protected]<br>
            <strong>Password:</strong> pa$$w0rd<br>
            <br>
            Then, in the drop down, select "Please Log Me In"<br><br>
            Check the box by "I love form manipulation"
        </div>

I want to get just that text :"[email protected]" from all that div I m using UFT and VBScript,

Thank you in advance !!

I tried that :


Set vo_LienDesc = Description.Create()

vo_LienDesc("micclass").Value = "WebElement"

vo_LienDesc("xpath").Value = "//div[1]/div[1]/div[1]/div[1]"
Set vo_Lien = Browser("Browser").Page("Authentication Test").ChildObjects(vo_LienDesc)
            
    If vo_Lien.count <> 0 Then
    MsgBox vo_Lien(0).GetROProperty("innertext")
    END if

but i'm always getting nothing, i don't what shoul i do??

0

There are 0 best solutions below