-1

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.

  • 1
    From Review: This question lacks any code to show us that you've made any attempt to solve this yourself. If you've tried something, show us what you've tried, example of the expected output and what you're actually getting. If you haven't tried anything, you need to do that before posting. We can help you with your existing code, but we won't write it for you. Please read: [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and also [How do I ask a good question](https://stackoverflow.com/help/how-to-ask)? – sɐunıɔןɐqɐp Oct 31 '19 at 11:06
  • Which binding are you using? – Rajagopalan Oct 31 '19 at 11:12
  • https://stackoverflow.com/questions/15510882/selenium-get-coordinates-or-dimensions-of-element-with-python – Krzy Oct 31 '19 at 11:34

1 Answers1

0

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

Zakaria Shahed
  • 2,589
  • 6
  • 23
  • 52