We got a requirment to validate whether a specific web element is on right or left or middle.
I want to validate position of webelement in selenium.
We got a requirment to validate whether a specific web element is on right or left or middle.
I want to validate position of webelement in selenium.
To verify the position you need to get X Y coordinates of the element
Here is the example of how you can get details and verify
WebElement Image = driver.findElement(By.xpath("//span[@props='pageHeaderProps']"));
//Get element width.
int ImageWidth = Image.getSize().getWidth();
System.out.println("Image width Is "+ImageWidth+" pixels");
//Get element height.
int ImageHeight = Image.getSize().getHeight();
System.out.println("Image height Is "+ImageHeight+" pixels");
Hope it will help you