Utilizing a Selenium web-server in Java for automating various web pages is my current task.
As an example:
WebDriver driver = new FirefoxDriver();
driver.get(url);
WebElement element = driver.findElement(By.id("some_id"));
I am wondering how to retrieve the absolute position of the element
.
In Javascript, it's possible to access the offsetTop
and offsetLeft
values of any DOM element:
var element = document.getElementById("some_id");
var offsetTop = element.offsetTop;
var offsetLeft = element.offsetLeft;
My initial thought was to execute the above script using a JavascriptExecutor
.
However, I would prefer to explore alternatives. Is there another method within Selenium to acquire these values?
Thank you