Sunday, October 22, 2017

Reports-Calender

' reporting functions:-
'------BAsic reporting status
'print micPass                 ' 0- passing
'print micFail                 '1-Fail
'print micDone                 '2 -Done
'print micGeneral             '2-General
'print micWarning             '3=Warning



Set myPage= Browser("creationtime:=0").page("page:=.*")
Reporter.ReportNote "opened the URL of application"
Browser("creationtime:=0").Navigate "http://www.rediff.com/"
myPage.Link("innertext:=Money").Click
myPage.Link("innertext:=My Portfolio","index:=0").Click
myPage.WebEdit("html id:=useremail").Set "sud3eer@rediffmail.com"
myPage.WebButton("html id:=emailsubmit").Click
myPage.WebEdit("html id:=userpass").Set "Pass@123"
myPage.WebButton("html id:=loginsubmit").Click

Reporter.ReportNote "loggedIN"' customized nore to reports
expectedName="sudheer reddy"

'myPage.Link("innertext:="&expectedName).GetRoProperty("name")
profileLinkExist= myPage.Link("innertext:="&expectedName).Exist
print profileLinkExist

' what is the status 
print Reporter.RunStatus
If profileLinkExist Then
Reporter.ReportEvent micPass,"LoginStatus","Login was successfull"
else
Reporter.ReportNote "Unsuccesfull to login" ' it will add to the reports as a NOTE
    mypage.CaptureBitmap "C:\error.png",true ' capture the screen short
    Reporter.ReportEvent micFail,"LoginStatus","Login was not successfull","C:\error.png"
    ExitRun 'if fails it will stop the execution
  
  
End If

print Reporter.RunStatus ' it will help to know the statusof reports
'reporter.ReportPath' it wil display the path of reportes stored

'reporter.Filter= rfDisabledAll' it is used to stop reporting on the script / it will ignore all reporter object
'reporter.Filter= rfEnabledAll ' it will enable to reporter objects and we can see in results



'Set myPage= Browser("creationtime:=0").page("page:=.*")
myPage.WebButton("html id:=addStock").Click
myPage.WebEdit("html id:=addstockname").Set "Bajaj Auto Ltd."
myPage.Link("html id:=stockPurchaseDate").Click

'---------------calender date selection


'Set myPage= Browser("creationtime:=0").page("page:=.*")
msgbox date
'UFT default data mm/dd/yyyy
selectDate cdate("10/21/2019")
myPage.WebEdit("html id:=addstockqty").Set "10"
myPage.WebEdit("html id:=addstockprice").Set "10"
myPage.WebElement("innertext:=NSE","index:=0").Click
myPage.WebElement("html id:=exchange_tab").Click



'FUNCTION FOR below if current date is less than datetobeSelected,greater than datetobeSelected,is qual to datetobeSelected

Function selectdate(datetobeSelected)
    currentDate=date
    diff=dateDiff("m",currentDate,datetobeSelected)
    print diff
  
    While (diff<>0 )
        If diff< 0 Then
        myPage.WebButton("innertext:=\<").Click
        currentDate=dateadd("m",-1,currentdate)
        ElseIf diff>0 Then
        myPage.WebButton("innertext:=\>").Click
            currentDate=dateadd("m",1,currentdate)
        End If
        diff=dateDiff("m",currentDate,datetobeSelected)  
    Wend
    myPage.WebElement("innertext:="&day(datetobeSelected)).click
'    Reporter.ReportEvent 
  
End Function

No comments:

Post a Comment

Description Programming

'==Descriptive Programming language 'creating the common browser and page object  Set  myPage= browser( "creationtime:=0...