Forum Discussion

sriram_sig's avatar
sriram_sig
Contributor
6 years ago

How to select value from a dropdown present in a web table

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 ...
  • shankar_r's avatar
    shankar_r
    6 years ago

    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

     

    1. Create two project variables named (rowIndex, columnIndex)
    2. Edit the RowIndex object property and change it project variable and select the rowIndex Variable
    3. Edit the ColumnIndex object property and change it project variable and select the columnIndex Variable
    4. And try with below code
        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!