Hi!
In advance: This is solved, I created my own function and that actually works..
But @Anshoo: No, this function is supposed to return a row number for a given text, so if there is a table and somehwhere in line 3 the word "test" occurs, normaly the this call GetRowWithCellText("text") should return 3. But that does not always work. Thanks anyway though!![Smile Smile](https://www.learnqtp.com/forums/images/smilies/smile.gif)
In case somebody wants to use my function, here it is. Its not very elegant, but I came to the conclusion that VBScript (or lets say the DotNet Object Model) does not want us to be elegant...
In advance: This is solved, I created my own function and that actually works..
But @Anshoo: No, this function is supposed to return a row number for a given text, so if there is a table and somehwhere in line 3 the word "test" occurs, normaly the this call GetRowWithCellText("text") should return 3. But that does not always work. Thanks anyway though!
![Smile Smile](https://www.learnqtp.com/forums/images/smilies/smile.gif)
In case somebody wants to use my function, here it is. Its not very elegant, but I came to the conclusion that VBScript (or lets say the DotNet Object Model) does not want us to be elegant...
Code:
Function getTableRowWithText(table, textToFind, exact, uncountHeader)
rows=table.rowCount()
getTableRowWithText=-1
if(table is nothing or textToFind="" or rows<1) then
Exit function
end if
For i=1 to rows
For j=1 to table.columnCount(i)
val=table.getCellData(i, j)
if(exact) then
if(val=textToFind) then
getTableRowWithText=i
if(uncountHeader) then
getTableRowWithText=getTableRowWithText-1
end if
Exit function
end if
else
if(instr(val, textToFind)>0) then
getTableRowWithText=i
if(uncountHeader) then
getTableRowWithText=getTableRowWithText-1
end if
Exit function
end if
end if
Next
Next
End Function