Get Classes returns empty list

Hello all,

I am trying to get element classes using the Get Classes keyword. However, I am always getting an empty list as a result.

Property: {}

Before that, there is Get Element States keyword, which checks that element is visible (successfully). I have also tried to use Wait For Condition first, waiting for Classes to contain a class which is always present for the element. Just to make sure classes are loaded. And it also returns an empty list.

Does anyone have an idea what could be the issue? Is there a mistake in my approach?

Thank you and best regards,
A

Hi Josh,

The fact your getting an empty list indicates the element you selected has no classes applied to it.

  • Perhaps your expecting to get inherited classes?
  • Perhaps you’ve selected an element and you need to select it’s parent?

I can only guess as you didn’t give us any indication of what your html and locators look like

hope that helps,

Dave.

Hi Dave,

Thank you for your reply. You just beat me to it by a minute.
The error was on my part indeed. I was using a selector for an inner element of a button, containing text. Not the outer button element, which contained the classes I was interested in.

Lesson learned, the keyword itself works very well.

Best,
A

1 Like