''Description: This function is used to search for WebElement value in Webtable and to click the webElement and returns true.If WebElement is not present then it return false.
''Arguments:
''
''Example:
'' Set objTable=Browser("Capital One").Page("ProphIT - 7560 - COF -").Frame("WorkFlowFrame").WebTable("Workflow")
'' strSearchValue="Add Notes"
''Return true/False
'Pre-Condition: Account Summary
'Post-Condition:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function fnSearchAndClick(objTable,strSearchValue)
On Error Resume Next
fnSearchAndClick=False
Dim intRowCount
Dim intColumnCount
Dim strFromScreen
Dim objChild
Dim intRowLoop
Dim intColumnLoop
Dim intChildCount
Set objFrame=objTable
Set objPage=Browser("Chordiant").Page("Chordiant")
Call fnSynchroniseObjects(objPage,objFrame,20)
Browser("Chordiant").Page("Chordiant").sync
If isObject(objTable) and objTable.exist(0) Then' This will check for the object name
intRowCount = objTable.RowCount ' This will get the row count in that table
If not intRowCount=0 Then ' This will check whether the table is present or not
For intRowLoop =1 to intRowCount ' this navigates inside the table based on the row count
intColumnCount= objTable.ColumnCount(intRowLoop) ' this get the column count by giving the row number
For intColumnLoop = 1 to intColumnCount ' this navigates inside the table based on the column count
strFromScreen=objTable.GetCellData(intRowLoop,intColumnLoop) ' this get the value from the screen
If strcomp(trim(strFromScreen),trim(strSearchValue),1)=0 Then ' this compares the value from screen with value given
intChildCount=objTable.ChildItemCount( intRowLoop,int(intColumnLoop-1), "WebElement")' Verify for Webelement insite that table and gets count of it
If intChildCount<>0 Then
Set objChild=objTable.ChildItem (intRowLoop,int(intColumnLoop-1), "WebElement", 0)' Creates child element object
objChild.click ' selects the child element object
fnSearchAndClick=True
intRowLoop=intRowCount
intColumnLoop=intColumnCount
exit function
Else
Set objChild=objTable.ChildItem (intRowLoop,0, "WebElement", 0)' Creates child element object
objChild.click ' selects the child element object
fnSearchAndClick=True
intRowLoop=intRowCount
intColumnLoop=intColumnCount
exit function
End If
End If
Next
Next
End If
End If
End Function
No comments:
Post a Comment