How to get this ID
I am doing automation using Selenium WebDriver and I am getting all table items.
I used the following code:
var qntd= driver.FindElements(By.XPath("//*[@id='dataTable']/tbody/tr")).Skip(3);
Then I realized that each element generated an Id which is not an Id as shown in the Html
I tried to get this id with the request but couldn't because return is an HTML Id attribute
var query = from a in qntd
select a.GetAttribute("Id");
Where does this ID come from and how do I get it?
source to share
Unfortunately, you will not be able to access this field because the FindElements method returns elements in the form IWebElement. IWebElement does not have an inline method to get the required identifier value.
If the FindElements method returned a RemoteWebElement or even a ChromeWebElement, we could access this field, because the RemoteWebElement has an accessor for it. However, this method is not implemented in the interface. Therefore we cannot get it. I played with the castings and could not distinguish them in the right place. So, at the moment I don't see a way to get this ID.
For more information, see the source code for RemoteWebElement.cs: https://github.com/SeleniumHQ/selenium/blob/master/dotnet/src/webdriver/Remote/RemoteWebElement.cs
Hope this helps you a little
source to share