Is there any way to test the layout with RC Selenium

I want to check the page layout. Something quite simple is that a particular div is displayed above / below / left / right of another div

Is it possible to do such things?

+3
source share
2 answers

Using the Ruby client ( @selenium- my object SeleniumDriver):

To check if any element is above another div:

@selenium.get_element_position_top("firstdiv") <
  @selenium.get_element_position_top("seconddiv")

To check if any element remains to another div:

@selenium.get_element_position_left("firstdiv") <
  @selenium.get_element_position_left("seconddiv")

If you also want to check that the elements do not overlap, compare the top of the element with the bottom of the other:

@selenium.get_element_position_top("firstdiv") + 
  @selenium.get_element_height("firstdiv") <
  @selenium.get_element_position_top("seconddiv")
+2
source

Galen Framework. , Selenium, . , . , .

@ all
------------------------------------
header, menu, footer
    width: 100% of screen/width

header
    height: 100px
    above: menu 0px

menu
    height: 50px
    above: content 0px

footer
    height: > 100px

content
    inside: screen 0px left

@ desktop, tablet
-----------------------------------
side-panel
    width: 300px
    below: menu 0px
    inside: screen 0px right
    near: content 10px right

@ mobile
-----------------------------------
side-panel, content
    width: 100% of screen/width

side-panel
    below: content 5px

TDD

+2

Source: https://habr.com/ru/post/1725819/


All Articles