How to get image Height and Width Together?

height = WebUI.getElementHeight(findTestObject())
width = WebUI.getElementWidth(findTestObject())

All i know is that we can get Height and Width Separately but is there a way to get them both at once? Like the result should be like This 120x550?

There may be something in org.openqa.selenium.Dimension that might help but really, I think writing your own Keyword would probably be better.

1 Like

Thank you, i’ll get back to this thread if it works :grin:

I’d prefer you get back either way :wink:

Well i can’t quite know how to use keywords properly when it comes to the width and height being on the same class :sweat_smile:

What do you mean?

Like on how can i get the Width X Height Result in one custom keyword

String wXh(TestObject to) {
  String w = WebUI.getElementWidth(to).toString()
  String h = WebUI.getElementHeight(to).toString()
  return w + "x" + h
1 Like


Your question was already answered in post 2. You need a custom keyword.

1 Like