Monday, July 13, 2015

C# Selenium - Get attribute value using XPath

Use following simple method to get Id attribute using XPath,

public string GetIDxpath(string xPath)
        {
            string id = driver.FindElement(By.XPath(@" + xPath + @")).GetAttribute("id");
            return id;
        }


0 comments