You are on page 1of 14

Functions

StepNa fKeyword me

Functions

Function browser_open( fURL) systemutil.Run "iexplore.exe", fURL browser_open=Browser("title:=.*").Page("title:=.*").GetROPro Open Gmail browser_open perty("title") End Function

Function image_check(fImage) ' O/P : True or False Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() Check Google Image image_check myo("micclass").value = "Image" myo("html tag").value = "IMG" myo("name").value = "Image" myo("alt").value = fImage (why we are using variable If myp.Image(myo).Exist(2) then image_check = True else image_check = False

End If Set myp = nothing Set myo = nothing End Function Link Check for Creating an Account Available space in megabyte Show Only number in megabyte Function edit_input(fName, fText) Wait 4 Dim myp, myo Set myo = Description.Create() myo("micclass").value = "WebEdit" Enter UID edit_input myo("name").value = fName myo("html tag").value = "INPUT" myo("index").value = 0 Browser("title:=.*").Page("title:=.*").webedit(myo).Set fText splitStr get_text link_check

edit_input=Browser("title:=.*").Page("title:=.*").webedit(myo).GetROP

roperty("innertext") Set myp = nothing Set myo = nothing End Function

Enter PWD Login to

edit_input

button_click Gmail Check Search Option Function get_text (fText) ' O/P : Inner text Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() Check Unread emails get_Text myo("micclass").value = "WebElement" myo("innertext").value = fText myo("index").value = 0 If myp.webelement(myo).Exist(2) then get_text = myp.webelement(myo).GetROProperty("innertext") else get_text = False End If edit_input

Set myp = nothing Set myo = nothing End Function

Check getItems_webli Gmail Drop st down list Open New message window Function browser_close() Close browser_close Browser End Function Browser("title:=.*").Close button_click

Function text_check(fText) ' O/P : True or False Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() myo("micclass").value = "WebElement" myo("innertext").value = fText myo("index").value = 0 If myp.webelement(myo).Exist(2) then

text_check = True else text_check = False End If Set myp = nothing Set myo = nothing End Function

Function edit_value(fName) Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() ' myo("micclass").value = "WebEdit" myo("type").value = ".*" myo("name").value = fName myo("html tag").value = "INPUT" myo("index").value = 0 edit_value = myp.webedit(myo).GetROProperty("value") Set myp = nothing Set myo = nothing End Function

Function edit_maxlength(fName) Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() ' myo("micclass").value = "WebEdit" myo("type").value = ".*" myo("name").value = fName myo("html tag").value = "INPUT" ' myo("index").value = 0 edit_maxlength = myp.webedit(myo).GetROProperty("max length") Set myp = nothing Set myo = nothing End Function

Function button_click(fName) Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() myo("micclass").value = "WebButton" ' myo("type").value = "submit" myo("name").value = fName myo("html tag").value = "INPUT" myo("index").value = 0 myp.webbutton(myo).Click

button_click=myp.webbutton(myo).GetROProperty("name") wait 3 Set myp = nothing Set myo = nothing End Function

Function text_check(fText) ' O/P : True or False Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() myo("micclass").value = "WebElement" myo("innertext").value = fText myo("index").value = 0 If myp.webelement(myo).Exist(2) then text_check = True else text_check = False End If Set myp = nothing Set myo = nothing End Function

Function link_click(fLinkText) Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() myo("micclass").value = "Link" myo("text").value = fLinkText myo("html tag").value = "A" myo("index").value = 0 myp.link(myo).Click Set myp = nothing Set myo = nothing End Function

Function link_check(fLinkText) ' O/P : True or False Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() myo("micclass").value = "Link" myo("text").value = fLinkText myo("html tag").value = "A" myo("index").value = 0

If myp.link(myo).exist(2) then link_check = True else link_check = False End if Set myp = nothing Set myo = nothing End Function

Function chk_WebChkBox(fName, fText) Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() myo("micclass").value = "WebCheckBox" myo("type").value = ".*" myo("name").value = fName myo("html tag").value = "INPUT" 'myo("index").value = 0 myp.WebCheckBox(myo).Set fText Set myp = nothing Set myo = nothing End Function

Function excelQuit

myxl.ActiveWorkbook.Save myxl.ActiveWorkbook.Close myxl.Application.Quit Set mysheet=nothing Set myxl =nothing End Function

Function selectWebList(WListName,FieldValue ) Set WListObj=Description.Create( ) WListObj("Class Name").Value="WebList" WListObj("html tag").Value="SELECT" WListObj("name").Value=WListName WListObj("visible").Value=True Set tPage=Browser("name:=.*").Page("title:=.*") tPage.WebList(WListObj).highlight Setting.WebPackage("ReplayType") = 2 tPage.WebList(WListObj).Select FieldValue Set WListObj=Nothing Set tPage=Nothing End Function

Public Function setWebRadioButton( WRdoBtnVal, WRdoBtnNam) Set WRadioBtn=Description.Create WRadioBtn("Class Name").Value="WebRadioGroup"

WRadioBtn("html tag").Value="INPUT" WRadioBtn("name").Value=WRdoBtnNam WRadioBtn("Index").Value= "0" Set tPage=Browser("name:=.*").Page("title:=.*") tPage.WebRadioGroup(WRadioBtn).highlight tPage.WebRadioGroup(WRadioBtn).Select WRdoBtnVal Set WRadioBtn = Nothing End Function

Function link_check(fLinkText)

Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create( ) ' Creates a blank description object myo("micclass").value = "Link" myo("text").value = fLinkText myo("html tag").value = "A" myo("index").value = 0 ' Oridnal identifier for the 1st object If myp.link(myo).exist(2) then link_check = True else link_check = False End if Set myp = nothing

Set myo = nothing End Function

Function select_webList(fName, fText) Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() myo("micclass").value = "WebList" myo("type").value = ".*" myo("name").value = fName myo("html tag").value = "SELECT" 'myo("index").value = 0 myp.WebList(myo).Select fText Set myp = nothing Set myo = nothing End Function

''Get All Items of a Weblist in a single string Function getItems_weblist(fName) Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() myo("micclass").value = "WebList" myo("type").value = ".*"

myo("name").value = fName myo("html tag").value = "SELECT" myo("index").value =" .*" getItems_weblist=myp.WebList(myo).getRoProperty("all items") Set myp = nothing Set myo = nothing End Function

Function edit_maxlength(fName) Dim myp, myo Set myp = Browser("title:=.*").Page("title:=.*") Set myo = Description.Create() ' myo("micclass").value = "WebEdit" myo("type").value = ".*" myo("name").value = fName myo("html tag").value = "INPUT" ' myo("index").value = 0 edit_maxlength = myp.webedit(myo).GetROProperty("max length") Set myp = nothing Set myo = nothing End Function

Function splitStr (fStr) CP=Replace(fStr,"Over"," ")

CP=Replace(CP,"megabytes (and counting) of free storage."," ") CP=Split(CP,".") Print CP(0) splitStr=CP(0) End Function

Function

errorHandler

CP=Err.Number If CP>0 Then errorHandler=Err.Description Else errorHandler="No Error" End If End Function

Function openPage( fURL) Browser("title:=.*").Navigate fURL openPage=Browser("title:=.*").Page("title:=.*").GetROProperty("title") End Function

You might also like