Reputation: 1612
If my font-size is set to be X-Large and I want to test how many pixels that is on a particular browser using Selenium WebDriver. How would I do that?
The idea is to check if the font size falls within a particular range of allowed font-sizes for our window size.
Upvotes: 4
Views: 19613
Reputation: 462
A way to do that is getting the font-size from the styles, e.g.
driver.findElement(By.id("xxx")).getCssValue("font-size");
And then, based on this information you could calculate the size by following this article: http://www.erinsowards.com/articles/2010/01/calculating-font-sizes.php
Upvotes: 2