Tuesday, 5 December 2017

UFT: Creation Time and Pop Up






Dim odic
Set odic=CreateObject("Scripting.Dictionary")

Set owt=Browser("Sample Page All Page").Page("Sample Page All Page").WebTable("EmpiId")
intemprc=Browser("Sample Page All Page").Page("Sample Page All Page").WebTable("EmpiId").RowCount
intempcc=Browser("Sample Page All Page").Page("Sample Page All Page").WebTable("EmpiId").ColumnCount(1)

For r = 2 To intemprc Step 1


    If owt.GetCellData(r,6)="Hyderabad" Then
    set objlink=owt.ChildItem(r,7,"Link",0)
  
  
                    If typename(objlink)="TextLink" Then
                  
                    text=r& " Row " &owt.GetCellData(r,2)
                  
                    odic.add text,"not present"
                      
                        objlink.Click
                         Browser("CreationTime:=1").Sync
                       
                           'Browser("CreationTime:=1").Page("title:=.*[A-Za-z0-9].*").highlight
                           Browser("CreationTime:=1").Page("title:=.*Wikipedia").highlight
                         
                           'Wikipedia
                         
                         set x= Browser("CreationTime:=1").Page("title:=.*[A-Za-z0-9].*")
                       
                         'Print isobject(x)'
                         if VerifyWebElement(x,"Hyderabad") then
                       
                         odic.item(text)="Present in pop up page"
                       
                         End if
                       
'                    
                       
                         Browser("CreationTime:=1").Close
                       
                       
                         wait 4
                    
                      End If
                      
    End If
  
  
  
Next


For each y in odic.Keys

print y &" "& odic.item(y)

Next

Function VerifyWebElement(objpage,strwebelement)

Dim owebelement
Set owebelement=Description.Create
owebelement("micclass").Value="WebElement"
owebelement("innertext").Value=strwebelement
owebelement("html tag").Value="h1"


set allwebelement=objpage.Childobjects(owebelement)
For i=0 to allwebelement.Count-1

If trim(allwebelement(i).Getroproperty("innertext"))=trim(strwebelement) Then
 
 VerifyWebElement=True
 Reporter.ReportEvent micPass,"Checkpoint for "&strwebelement," "&strwebelement&" is Present on the webpage"

 
Else

  VerifyWebElement=False

End If
 
Next
End Function


Set odic=nothing




******
3 Row 102 Present in pop up page
4 Row 102 Present in pop up page
5 Row 102 not present

No comments:

Post a Comment

Spring Boot : Exception Handler 14