Question: Is there a keyword in Robot Framework to ensure element has a certain class? Something like

`Element should has class element className`

Alternatively, I could check if element has a certain attribute with certain value. Former would be more suitable though, as element may contain multiple classes.

Answer: 
Here's an alternative solution (though the accepted answer's CSS one is quite good), working for any kind of selector strategy:

```
Element should have class
    [Arguments]  ${locator}  ${target value}

    ${class}=       Get Element Attribute  ${locator}@class
    Should Contain  ${class}        ${target value}

```

It can be modified for any other attribute - just substitute the `@class` in `Get Element Attribute` with it (or even, make it an optional argument).
Here below an example of both ways:

```
    ${temp}=    get element attribute       xpath=/elementpath    class
    should contain        ${temp}   ${ClassName}

```

OR

```
 Wait until page contains element  xpath=/elementpath[contains(@class, '${ClassName}')

```