1

I am in process of evaluating Galen as UI automation framework. I am blocked at one point where Galen is unable to give correct results in case of padding around an element. This is the sample DOM.

<html>
 <body>
  <div id="div1" style="background-color: yellow; height:200px; width:500px">
   <div id="div2" style="padding-left:15px; padding-right:15px; background-color: red; height:100px;">
    <h2>TEST CONTENT</h2>
   </div>
  </div>
 </body>
</html>

My spec file reads as below

@objects
    div1    //div[@id="div1"]
    div2    //div[@id="div2"]/h2

= Personal Tab =
    @on desktop
        div2:
            inside div1 15px left right

On running the test the failure message reads something like below

div2 is 0px right instead of 15px

I read one of the posts which suggested to use CSS properties using selenium. I do not want to use this method. Instead if there is anything provided by Galen would be useful

Any clues what can be alternative to solve the puzzle ?

2
  • 1
    got this resolved. It was my misunderstanding about css padding/border/margin concepts. Apologies for the noise and Thanks everyone for your help Commented Mar 22, 2016 at 9:01
  • Can you post your answer? Commented Feb 24, 2018 at 20:53

1 Answer 1

2

Since the padding is the space inside div. When the rendered look like

enter image description here

According to the sample HTML, I'd write my test to verify

  • There are three objects; div1, div2 and h2. In your code, you define div2 object name to h2 actual object. It's confuse.
  • div2 is fit inside div1, the top left right is 0px.
  • h2 is inside div2, the left is 15px. The right is apparently not 15px, I might not put it to the script. If you want to, you can do a math.

Therefore the code will be:

@objects
div1    //div[@id="div1"]
div2    //div[@id="div2"]
h2      //div[@id="div2"]/h2

= Personal Tab =
    @on desktop
        div2:
            inside div1 0px left right, 0px top
        h2:
            inside div2 15px left

I don't have Galen installed to verify my answer but I think it could help. :) Good luck.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.