How to get x and y coordinates of an element using Selenium Webdriver

package selenium_examples;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Sample {

public static void main(String[] args)

WebDriver driver = new FirefoxDriver();
System.out.println("X Position= "+ driver.findElement("btnK")).getLocation().getX());
System.out.println("Y Position= "+ driver.findElement("btnK")).getLocation().getY());



X Position= 373
Y Position= 386

No comments:

Related Posts Plugin for WordPress, Blogger...