How can I access the column-index value of an element whose aria-label I know using Selenium web driver in c#

0

I want to access the aria-colindex value of an element using the aria-label value, how can I do this in the cleanest way using selenium or c#

driver.FindElement(By.XPath("//td[@aria-label='Sütun Stok']"));

<td aria-selected="false" role="columnheader" aria-colindex="3" id="dx-col-95" aria-label="Sütun Stok" class="dx-datagrid-action dx-cell-focus-disabled dx-datagrid-drag-action" aria-sort="none" tabindex="0" style="text-align: left; min-width: 45px; max-width: 250px; width: 250px;" xpath="1"><div class="dx-column-indicators" role="presentation" style="float: right;"><span class="dx-sort dx-sort-none"></span></div><div class="dx-datagrid-text-content dx-text-content-alignment-left" role="presentation" title="Stok">Stok</div></td>

my element is here

c#
2021-11-24 05:54:36
1

0

I was able to access the attribute value I wanted using GetDomAttribute, I'm leaving the code here in case you need it.

var element=  driver.FindElement(By.XPath("//td[@aria-label='Sütun Stok']")).GetDomAttribute("aria-colindex");
2021-11-24 06:27:15

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................