Forum Discussion

anuragrbl's avatar
anuragrbl
Occasional Contributor
6 days ago

How can we fetch ColumnIndex based on Column Name for Syncfusion Grid Control in Python

I was following below page for reference but didn't get also do we have more clear documentation for Syncfusion control ?

https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/grids/syncfusion-grid-control/index.html

5 Replies

  • Did you check the sections at the bottom of that page? They all have examples of code to do different things.

     

    • Marsha_R's avatar
      Marsha_R
      Icon for Champion Level 3 rankChampion Level 3

      Can you use Object Spy on one of the cells and let us see the properties?

  • Can you provide a screenshot of the Object Spy tool, with the properties of your grid control?

  • In concept web page table should not be too different from Windows forms table, and following this example you should be able to manipulate it. You only need to figure out your available similar properties for ColumnIndex and RowIndex. 

    Access https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_intro 

    On Project level variables add the following string variables:
    ColumnName
    ColumnIndex
    RowIndex

    In NameMapping map the following nodes under NameMapping.Sys.browser.pageW3schoolsTryitEditor.frameIframeresult
    column with XPath=//th[.='%ColumnName%']
    row with XPath=//tr[%RowIndex%]/td[%ColumnIndex%]

    Now you can test it with this code, modify the ColumnName and RowIndex to your choosing

    def Test1():
        Var1 = 0
        Browsers.Item[btChrome].Run("https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_intro")
        Aliases.browser.pageW3schoolsTryitEditor.Wait()
        Aliases.browser.pageW3schoolsTryitEditor.frameIframeresult.RefreshMappingInfo()
        Project.Variables.ColumnName = "Contact"
        Project.Variables.RowIndex = "3"
        Var1 = Aliases.browser.pageW3schoolsTryitEditor.frameIframeresult.column.ColumnIndex
        Project.Variables.ColumnIndex = Var1 + 1
        Log.Message(Aliases.browser.pageW3schoolsTryitEditor.frameIframeresult.row.contentText, "")

    P.S. if you like my post give a like, and if it solved your problem mark it as solution to give credit.