verifying width and height?

How do I verify the width and height of an element on my website? I know the 'supposed to be' values, but cannot find a command to verify. Get element width/height only picks the value, not verifies the current value.


  • You can use 'Get Element Width/Height' keywords to get the value and then use that for comparison, e.g:

    WebUI.verifyEqual(WebUI.getElementWidth, 20)
  • edited September 7

    I cannot get it to work... I use this script:
    WebUI.getElementWidth(findTestObject('STW_headerimage_homepage/ul_hero-team (1)'))

    width = 772

    I tried:
    WebUI.verifyEqual(WebUI.getElementWidth('STW_headerimage_homepage/ul_hero-team (1)'), 772)
    WebUI.verifyEqual(WebUI.getElementWidth, 772)
    ...and other variations to no avail, what am I doing wrong?

  • Hi there,

    You miss to call 'findTestObject' in parameter of getElementWidth. Your correct script should be:
    WebUI.verifyEqual(WebUI.getElementWidth(findTestObject('STW_headerimage_homepage/ul_hero-team (1)')), 772)

  • Thanks Hanh Tran, for you prompt reply, works fine now.

Sign In or Register to comment.