Skip to main content
improved question
Source Link
Bharat Mane
  • 6.8k
  • 11
  • 41
  • 69

Has anyone tried to test the page layout of a website using webdriver? To be specific, using webelement.getPosition() and webelement.getDimension().

Has anyone tried to test the page layout of a website using webdriver? To be specific, using webelement.getPosition() and webelement.getDimension().

Shouldn't these two methods be enough for testing the layout of the page. I did a quick test and found that the location would return the location of the element relative to the left top corner of the page. That means this should always return the same value irrespective of monitor resolution or window size.

If I can record the location and element dimension once and store those values somewhere, I can run automated tests using selenium to find whether the position or dimension of the element changed. If that change is greater than a delta value which I set, then it means the alignment of the element has changed and I can fail the test.

I am planning to create some utility program which does this, but wanted to confirm that this would indeed be enough to test the page layout

I am planning to create some utility program which does this, but wanted to confirm that this would indeed be enough to test the page layout

Has anyone tried to test the page layout of a website using webdriver? To be specific, using webelement.getPosition() and webelement.getDimension().

Shouldn't these two methods be enough for testing the layout of the page. I did a quick test and found that the location would return the location of the element relative to the left top corner of the page. That means this should always return the same value irrespective of monitor resolution or window size.

If I can record the location and element dimension once and store those values somewhere, I can run automated tests using selenium to find whether the position or dimension of the element changed. If that change is greater than a delta value which I set, then it means the alignment of the element has changed and I can fail the test.

I am planning to create some utility program which does this, but wanted to confirm that this would indeed be enough to test the page layout

Has anyone tried to test the page layout of a website using webdriver? To be specific, using webelement.getPosition() and webelement.getDimension().

Shouldn't these two methods be enough for testing the layout of the page. I did a quick test and found that the location would return the location of the element relative to the left top corner of the page. That means this should always return the same value irrespective of monitor resolution or window size.

If I can record the location and element dimension once and store those values somewhere, I can run automated tests using selenium to find whether the position or dimension of the element changed. If that change is greater than a delta value which I set, then it means the alignment of the element has changed and I can fail the test.

I am planning to create some utility program which does this, but wanted to confirm that this would indeed be enough to test the page layout

Tweeted twitter.com/#!/StackSQA/status/205074454504669184
edited tags
Link
A.J
  • 793
  • 3
  • 7
  • 19
Source Link
A.J
  • 793
  • 3
  • 7
  • 19

Testing Page Layout with webdriver

Has anyone tried to test the page layout of a website using webdriver? To be specific, using webelement.getPosition() and webelement.getDimension().

Shouldn't these two methods be enough for testing the layout of the page. I did a quick test and found that the location would return the location of the element relative to the left top corner of the page. That means this should always return the same value irrespective of monitor resolution or window size.

If I can record the location and element dimension once and store those values somewhere, I can run automated tests using selenium to find whether the position or dimension of the element changed. If that change is greater than a delta value which I set, then it means the alignment of the element has changed and I can fail the test.

I am planning to create some utility program which does this, but wanted to confirm that this would indeed be enough to test the page layout