1

My company is trying to perform a browser update from IE8 to IE11. They want my team to automate tests that determine if their applications' web-elements have shifted at all in IE11 compared to IE8.

I did some research and found that the .getLocation() method returns the (x,y) points of an element on the screen. My questions are: what do they use exactly to measure x and y coordinates (i.e. pixels / screen size)? Does it take into account the browser's tool bar at the top of the screen?

I have my doubts about the .getLocation()method so is there a better and more efficient way (than .getLocation()) of determining if a shift has occurred in a web-element's location from browser to browser?

Dr.Hussain
  • 11
  • 1

1 Answers1

1

From this link, it looks like the location is measured from the HTML content render pane and therefore ignores the browser window, etc.

You could use JavascriptExecutor and then .getBoundingClientRect but I'm not sure if that will return you any different results. My guess is .getLocation is a wrapper to the JS commands but I can't prove that.

You might consider using an existing tool that compares a page in two browsers. I remember using one years ago that displayed every difference in element position between two browsers but I don't remember now what it was.

Community
  • 1
  • 1
JeffC
  • 22,180
  • 5
  • 32
  • 55
  • thank you. I've been researching and it might be what I am looking for; a .getLocation() with more functionality. Can this be implemented using the [JavascriptExecutor](http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/JavascriptExecutor.html)? – Dr.Hussain Aug 14 '15 at 18:31
  • It can but I'm not sure what additional functionality it would get you. From what I can gather, you should be able to accomplish your objective using just `.getLocation()`. I would be shocked if this wasn't already created... I would do more searching for existing tools. – JeffC Aug 18 '15 at 14:06