I'm able to retrieve value from a cell using the below code -
form.panel4.table.rows.item(1).cells.item(8).innertext()
but looking for a solution to select the value from a dropdown present in one of the cells of webtable.
Solved! Go to Solution.
This screen tells me what is going wrong,
Cell is the ObjectType and is not a callable function. This is what you can do.
Option #1
You can do like below
if(form.panel4.table.Exists){ var propNames = ["ObjectType","RowIndex","ColumnIndex"]; var propValues = ["Cell","1","8"]; var cellObject = form.panel4.table.FindChild(propNames,propValues); if(cellObject.Exists){ textNodeObj = cellObject.FindChild("textnode propnames","textnode propvalues"); textNodeObj.click(); textNodeObj.Keys("[Down]"); } }
Option #2
Project.Variables.rowIndex = 1; Project.Variables.columnIndex = 8; if(form.panel4.table.Cell2.textnode.Exists){ form.panel4.table.Cell2.textnode.click() form.panel4.table.Cell2.textnode.Keys("[Down]") }
Let me know if this works for you!
LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com
“You must expect great things from you, before you can do them”Easiest way to find out is to record a test and walk through the steps that you want.
https://support.smartbear.com/testcomplete/docs/tutorials/getting-started/first-test/web/index.html
This is how it looks when i record it
panel4.table.cell2.textnode.Click(59, 15) panel4.textnode.Click(42, 15)
Were you able to spy the dropdown object, if yes then
More details on the object and screenshot would be better to help
LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com
“You must expect great things from you, before you can do them”Thanks for your suggestion. This dropdown gets identified as a textnode and it would be present in the last column of all the rows. In the name mapping it is under the below heirarchy
form->panel->table->cell2->texnode. Property of cell has row and index
for now i'm able to select some value from the dropdown with the below code
form.panel4.table.Cell2.textnode.click() form.panel4.table.Cell2.textnode.Keys("[Down]")
But Cell2 is not the ideal way to do, since it has a particular row and column mapped to it.
tried with below code - but it is not working. I can pass the row and column as variables in the code
form.panel4.table.Cell(1,8).textnode.click() form.panel4.table.Cell(1,8).textnode.Keys("[Down]")
First thing first, do exists before any action on the object.
if(form.panel4.table.Cell(1,8).Exists){ form.panel4.table.Cell(1,8).textnode.click() form.panel4.table.Cell(1,8).textnode.Keys("[Down]") }
If cell not exists then we can't do anything,
LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com
“You must expect great things from you, before you can do them”Yes i did try this, and got this error message. But when i do cell2 instead of cell(1,8) in the below code it does work fine.
This screen tells me what is going wrong,
Cell is the ObjectType and is not a callable function. This is what you can do.
Option #1
You can do like below
if(form.panel4.table.Exists){ var propNames = ["ObjectType","RowIndex","ColumnIndex"]; var propValues = ["Cell","1","8"]; var cellObject = form.panel4.table.FindChild(propNames,propValues); if(cellObject.Exists){ textNodeObj = cellObject.FindChild("textnode propnames","textnode propvalues"); textNodeObj.click(); textNodeObj.Keys("[Down]"); } }
Option #2
Project.Variables.rowIndex = 1; Project.Variables.columnIndex = 8; if(form.panel4.table.Cell2.textnode.Exists){ form.panel4.table.Cell2.textnode.click() form.panel4.table.Cell2.textnode.Keys("[Down]") }
Let me know if this works for you!
LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com
“You must expect great things from you, before you can do them”Thanks a lot for giving a solution. Option 1 worked perfectly fine
Also is there a way to select a value from the dropdown rather than doing the keys. Would the findchild method work here