I want to check the layout of the page. Something pretty simple - that a certain div is displayed above/below/left/right of another div
Is it possible to do this kind of stuff?
I want to check the layout of the page. Something pretty simple - that a certain div is displayed above/below/left/right of another div
Is it possible to do this kind of stuff?
Using the Ruby client (@selenium
is my SeleniumDriver
object):
To check if a certain element is above another div:
@selenium.get_element_position_top("firstdiv") <
@selenium.get_element_position_top("seconddiv")
To check if a certain element is left to another div:
@selenium.get_element_position_left("firstdiv") <
@selenium.get_element_position_left("seconddiv")
If you also want to check that the elements don't overlap, compare the top of the element to the bottom of the other:
@selenium.get_element_position_top("firstdiv") +
@selenium.get_element_height("firstdiv") <
@selenium.get_element_position_top("seconddiv")