How to verify element/object is highlighted or selected

So I’ve tried different methods to try to verify a button is highlighted or selected.
I even tried the boolean status= element.isSelected() method (similar to selenium)…

This is the button I’m trying to verify selected: Screenshot by Lightshot

hi,

check this demo

hi,

maybe this will help you
WebDriver driver = DriverFactory.getWebDriver()
String color = driver.findElement(By.xpath("//a[@id='btn-make-appointment']")).getCssValue("color");
String backcolor = driver.findElement(By.xpath("//a[@id='btn-make-appointment']")).getCssValue("background-color");
System.out.println(color);
System.out.println(backcolor);
if(!color.equals(backcolor)){
	System.out.println("Text is highlighted!")
}
else{
	System.out.println("Text is not highlighted!")
}

I think most or at least some web-based app has a variation of the class object property when it’s highlighted vs. non - if that’s the case, it’s pretty easy to get the property when it’s highlighted and validate it with either assert method or verification- which is what I realized after posting this. Simple tweak but works fine!