Thanks for your reply regarding my query. I have implemented that and its working fine.
if somebody wants to use the function, its following (or if you could add this in your selenium default product with some modifications if needed) . Similarly a function assertElementLeft() can also be written

Selenium.prototype.assertElementAbove = function(locator1, locator2) {

var element1 = this.page().findElement(locator1);

var element2 = this.page().findElement(locator2);

// Get Y coordinates of elements

var Y1 = findPosY(element1);

var Y2 = findPosY(element2);

if(parseFloat(Y1) >= parseFloat(Y2))

{

Assert.fail("first element(Y Coordinate="+Y1+") is not above second element(Y Coordinate="+Y2+")");

}

};

function findPosY(obj)

{

var curtop = 0;

if (obj.offsetParent)

{

while (obj.offsetParent)

{

curtop += obj.offsetTop

obj = obj.offsetParent;

}

}

else if (obj.y)

curtop += obj.y;

return curtop;

}

_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to