Does Linq generate this ID? How to recover?

0

I'm doing an automation using Selenium WebDriver and I'm getting all the elements of a Table.

I used the code below:

var qntd= driver.FindElements(By.XPath("//*[@id='dataTable']/tbody/tr")).Skip(3);

I then realized that each element generated an Id that is not of the Html Id attribute

ItriedtoretrievethisidwithaquerybutIcouldnotbecausethereturnistheHTMLIdAttribute

varquery=fromainqntdselecta.GetAttribute("Id");

Where does this ID come from and how do I retrieve it?

    
asked by anonymous 27.07.2017 / 15:34

1 answer

0

Unfortunately you will not be able to access this field because the "FindElements" method returns the elements in the form of IWebElement. IWebElement does not have a method implemented to get the ID value I was looking for.

If the FindElements method was to return the type RemoteWebElement, or even ChromeWebElement, we could access this field because the RemoteWebElement has a method to access it. However, this method is not implemented in the interface. Therefore, there is no way to achieve this. So I'm not seeing a way to get this ID.

See the RemoteWebElement.cs source code for more information:

link

    
28.07.2017 / 14:11