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 in one of the cells of webtable.

  • 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!

     

     

    • sriram_sig's avatar
      sriram_sig
      Contributor

      This is how it looks when i record it

      panel4.table.cell2.textnode.Click(59, 15)
      panel4.textnode.Click(42, 15)
      • shankar_r's avatar
        shankar_r
        Community Hero

        Were you able to spy the dropdown object, if yes then

        1. Take the properties of the dropdown object,
        2. Loop thru each cell and identify which has to have dropdown with the use of properties 
        3. Click on the drop down, try to find spy objects in the list and repeat the 1 and 2 cells.

        More details on the object and screenshot would be better to help