This blog expressed my technology vision and based on my professional experience in the Software industry.
Contains Knowledge base, Tutorials, Code examples and Best practices of frequently Software design issues.

Pages

Friday, March 3, 2017

Selenium WebDriver – Working with child element of a table (C#)

Until
now we worked with simple tables that allow us to perform all operation without
any major challenges. However, in some projects, you will face tables that
possess child elements that dynamically created based on user operations,
therefore we will need to use some advanced strategies to locate child elements
using XPath and CSS.

To
demonstrate the code examples, we will use the following HTML table:

As you can see from the HTML snippet, the
user ID is not static and Therefore we cannot use the regular locator
strategies (The ID attribute cannot be associated to a user), to overcome this
issue we can us the XPath and CSS selectors in the following way: