Good fit for CSS

Is eggplant a good fit for testing CSS issues cross browser?

Essentially the expected outcome would be for all elements to appears in the same location. Is Eggplant used in this way? Is it recommended?

Yes, this would be a fine application for Eggplant, since it can work with any browser on any platform. The ImageLocation() function can be used to find exactly where each element appears on the screen.

In this case you would most likely want to know the element location relative to the browser window, since the browser might not always be displayed in the same place. A simple way to do this would be to first record the location of the top-left corner of the browser. Then simply subtract that location from the location of the element to get its relative location within the window:

put imageLocation("BrowserTopLeft") into topLeft -- record the browser location
put imageLocation("Element1") - topLeft into Element1Loc
put imageLocation("Element2") - topLeft into Element2Loc

That should get you started. To verify that the locations are within some required tolerance (say 5 pixels in any direction) of the expected location, you could check the x and y values of each location:

-- assume that ExpectedLoc1 has been set to the expected location of element 1

put Element1Loc - ExpectedLoc1 into variance1
if variance1.x is not between -5 and 5 or variance1.y is not between -5 and 5 then
    LogError "Element 1 not found where expected"
end if