I have the following code that searches a table that can be indexed by pages. What I do not know what is the return value of myTable.Find.ByContent when the search string is not matched. Also what’s a slick way to do an index search in the pages till the string is found. I want to mimic what a user would do in index.
Thanks,
John
Dim
MySearchString as
String
MySearchString =
"Start All over III"
' Copy the table into a local variable to make it easier to work with
Dim
myTable
As
HtmlTable = Pages.JointCommissionResources9.CphTracerPageRadMyOrgTracesTable
' Locate the row we want using text content (Enter the String to search by
Dim
row
As
HtmlTableRow = myTable.Find.ByContent(Of HtmlTableCell)(MySearchString).Parent(Of HtmlTableRow)()
' Locate the delete icon (which is going to be just an anchor tag) located in the third column of the current row
'Dim link As HtmlAnchor = row.Cells(5).Find.ByExpression(Of HtmlAnchor)("uniquename=UrgbtnEditResponse")
'uniquename="UrgbtnNewResponse"
Dim
link
As
HtmlAnchor = row.Cells(5).Find.ByExpression(Of HtmlAnchor)(
"uniquename=UrgbtnNewResponse"
)
'Dim link As HtmlAnchor = row.Cells(4).Find.ByExpression(Of HtmlAnchor)("value=Print/Preview")
' Now that we've found it, click the delete icon
link.Click()
HtmlTableCell Find By Search
String
Dim
MySearchString
As
String
Dim
PageNumber
As
Integer
MySearchString =
"this is a new tracer"
Log.WriteLine(
"Value: "
& MySearchString)
Log.WriteLine(
"Pages: "
& GetExtractedValue(
"x2StrongTag"
).ToString())
' Copy the table into a local variable to make it easier to work with
Dim
myTable
As
HtmlTable = Pages.JointCommissionResources9.CphTracerPageRadMyOrgTracesTable
Log.WriteLine(
"Table when Nothing found: "
& myTable.ToString)
' Locate the row we want using text content (Enter the String to search by
'Dim row As HtmlTableRow = myTable.Find.ByContent(Of HtmlTableCell)("Article B01").Parent(Of HtmlTableRow)()
Dim
row
As
HtmlTableRow = myTable.Find.ByContent(Of HtmlTableCell)(MySearchString).Parent(Of HtmlTableRow)()
' Locate the delete icon (which is going to be just an anchor tag) located in the third column of the current row
'Dim link As HtmlAnchor = row.Cells(5).Find.ByExpression(Of HtmlAnchor)("uniquename=UrgbtnEditResponse")
'uniquename="UrgbtnNewResponse"
Dim
link
As
HtmlAnchor = row.Cells(5).Find.ByExpression(Of HtmlAnchor)(
"uniquename=UrgbtnNewResponse"
)
'Dim link As HtmlAnchor = row.Cells(4).Find.ByExpression(Of HtmlAnchor)("value=Print/Preview")
' Now that we've found it, click the delete icon
link.Click()