Hey Kamal, you can use following code snippet to check whether a text is underlined or not. But first you need to identify the underlined property. You can Identify by getCssValue(“border-bottom”) or sometime getCssValue(“text-decoration”) method if the cssValue is 'underline' for that WebElement or not.
public class UnderLine {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://www.google.co.in/?gfe_rd=ctrl&ei=bXAwU8jYN4W6iAf8zIDgDA&gws_rd=cr");
String cssValue= driver.findElement(By.xpath("//a[text()='Hindi']")).getCssValue("text-decoration");
System.out.println("value"+cssValue);
Actions act = new Actions(driver);
act.moveToElement(driver.findElement(By.xpath("//a[text()='Hindi']"))).perform();
String cssValue1= driver.findElement(By.xpath("//a[text()='Hindi']")).getCssValue("text-decoration");
System.out.println("value over"+cssValue1);
driver.close();
}
}