Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98800

How to identify tags for which those don't have the style attribute?

$
0
0

I have a scenario where there is a table and when I search that table i will get a result set and I need to verify whether the search data is available in search result or not.I have around 1000 li tags and the only way to verify the result set by its attribute 'style'. for result set, there is no 'style' attribute in li tags.

public boolean isAttribtuePresent(WebElement element, String attribute) {
    Boolean ATTRIB_PRESENT = true;

    try {
        String value = element.getAttribute(attribute);
        if (value.isEmpty() || value == "" || value == null) {
            ATTRIB_PRESENT = true;          
        }
    } catch (Exception e) {
        ATTRIB_PRESENT = false; 
    }

    return ATTRIB_PRESENT;
} 

I tried with this but it is validating all LI tags


Viewing all articles
Browse latest Browse all 98800