Getting table cell value in Selenium C#

c#, selenium

Solution

To get a specific cell using selenium C# its `selenium.GetTable("table.1.2")` where `table` is the name of the table, `1` is the row and `2` is the cell.

e.g.

    [Test]
    public void TableTest()
    {
        try
        {
            Assert.AreEqual("value that should be in the cell", selenium.GetTable("table.1.2"));
        }
        catch (AssertionException e)
        {
            verificationErrors.Append(e.Message);
        }
    }

To get around the basic auth situation you will need to use http://username:password@example.com as the url where username and password will get you through to the page but more and more browsers are starting to block this so beware. Where I work we avoid this scenario.

Problem

If I have a table in Selenium and I want to get a specific cell in a row, what would be the relevant method call? What I am confused about is the specific value I am looking for comes up more than once in the table so how do I know which value is found? Furthermore, how can I pass credentials via basic auth? Thanks

Original source