My question is similar to this one: How to get HTML code of a WebElement in Selenium
I am trying to hit a close button, that looks like this:
OuterHTML: <input class="form-control btn btn-clear" style="font-family: MapIcons; padding: 0px;" value="" type="button">
That value attribute appears in the Unicode Lookup as Hex 0xE01D
I am trying to match that attribute before I click on it.
This is my code:
List<WebElement> elements = driver.findElements(By.xpath("//input[contains(@class, 'form-control btn btn-clear')]"));
Common.myPrint(thisClass + " elements count: " + elements.size());
for (WebElement element : elements) {
// select an element
if(element.isDisplayed()) {
String text=element.getAttribute("value");
if(text!=null) {
Common.myPrint(thisClass + " text: " + text);
// I would like to put compare text here, to ensure I have
// correct element, before clicking on it.
}
}
}
I have run this, and the Console.log displays this:
text: ?
so it would appear that WebElement.getAttribute("value") does not return that value accurately anyway.