Using selenium.GetAttribute in Webdriver

Here is the Selenium RC code for selenium.GetAttribute in Webdriver. This code is in Visual Studio C#

public string GetAttribute(string xpath)
string text = "";
if (IsElementPresent(xpath))
text = driver.FindElement(By.XPath(xpath)).GetAttribute("href");
return text;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>