Hi, devs,About two years ago Eran started rework of the advanced user interactions -- https://code.google.com/p/selenium/source/detail?r=11008 . He introduces a new method Locatable.getCoordinates() that should allow to get various kinds of element location info:Locatable.getCoordinates().getLocationOnScreen()Locatable.getCoordinates().getLocationInViewPort()Locatable.getCoordinates().getLocationInDOM()
Only first of these methods was implemented -- RemoteWebElement.getCoordinates().getLocationOnScreen() is an alias for getLocationOnceScrolledIntoView()Unfortunately, semantics of these methods was not defined, and I want to do this now.I suggest the following:1) getLocationOnScreen() should return location of the element relative to the top-left corner of the monitor (screen). The result can be used in the tools like Java AWT Robot to act (e.g. click) by coordinates.
2) getLocationInViewPort() should return location of the element relative to the top-left corner of the browser viewport or the frame that contains this element. The result can be used to do some actions by coordinates in JavaScript.
3) getLocationInDOM() -- I have no idea what was the intention of this method, de we need this at all? :)
And see a separate message about scrolling.Regards,
--Alexei BarantsevSoftware-Testing.RuSelenium2.Ru
--
On Fri, Dec 21, 2012 at 1:08 PM, Alexei Barantsev <bara...@gmail.com> wrote:Hi, devs,About two years ago Eran started rework of the advanced user interactions -- https://code.google.com/p/selenium/source/detail?r=11008 . He introduces a new method Locatable.getCoordinates() that should allow to get various kinds of element location info:Locatable.getCoordinates().getLocationOnScreen()Locatable.getCoordinates().getLocationInViewPort()Locatable.getCoordinates().getLocationInDOM()These method names seem a little redundant. Could we rename them?getCoordinates().onScreen();getCoordinates().inViewPort();
See comment below for InDOM.Only first of these methods was implemented -- RemoteWebElement.getCoordinates().getLocationOnScreen() is an alias for getLocationOnceScrolledIntoView()
Unfortunately, semantics of these methods was not defined, and I want to do this now.I suggest the following:1) getLocationOnScreen() should return location of the element relative to the top-left corner of the monitor (screen). The result can be used in the tools like Java AWT Robot to act (e.g. click) by coordinates.SGTM - what if the element is in a frame and not within view of parent?
2) getLocationInViewPort() should return location of the element relative to the top-left corner of the browser viewport or the frame that contains this element. The result can be used to do some actions by coordinates in JavaScript.Lets avoid complications with frames and have this always be relative to element's viewport (element.ownerDocument.defaultView).
3) getLocationInDOM() -- I have no idea what was the intention of this method, de we need this at all? :)This is probably intended to be relative to the overall structure of the page, independent of the viewport/scrolling. If it's not used right now, let's delete it.
And see a separate message about scrolling.Regards,--Alexei BarantsevSoftware-Testing.RuSelenium2.Ru--
--
Hi, devs,
Resuming all comments:
1) Method Locatable.getCoordinates().getLocationOnScreen() should be renamed to Locatable.getCoordinates().onScreen()
This method should return location of the element relative to the top-left corner of the monitor (screen)
This method should try to scroll the page and/or frames to make element visible before calculating its coordinates.
If the element can't be scrolled into view the method should throw an ElementNotVisibleException
2) Method Locatable.getCoordinates().getLocationInViewPort() should be renamed to Locatable.getCoordinates().inViewPort()
This method should return location of the element relative to the top-left corner of whatever OS-window is being used to display the content. Usually it is the browser window's viewport.
This method should try to scroll the page and/or frames to make element visible before calculating its coordinates.
If the element can't be scrolled into view the method should throw an ElementNotVisibleException
3) Method Locatable.getCoordinates().getLocationInDOM() should be renamed to Locatable.getCoordinates().onPage()
This method should return location of the element relative to the top-left corner of the page.
This method should NOT scroll the page and/or frames.
4) Method Locatable.getLocationOnceScrolledIntoView() should be deprecated and removed lately because it is redundant, Locatable.getCoordinates().inViewPort() should be used instead.
5) Method WebElement.getLocation() should delegate down to Locatable.getCoordinates().onPage()
Any additional comments?
Inline.On Sun, Jan 27, 2013 at 3:16 PM, Alexei Barantsev <bara...@gmail.com> wrote:
Hi, devs,
Resuming all comments:
1) Method Locatable.getCoordinates().getLocationOnScreen() should be renamed to Locatable.getCoordinates().onScreen()
This method should return location of the element relative to the top-left corner of the monitor (screen)
This method should try to scroll the page and/or frames to make element visible before calculating its coordinates.
If the element can't be scrolled into view the method should throw an ElementNotVisibleException
SGTM2) Method Locatable.getCoordinates().getLocationInViewPort() should be renamed to Locatable.getCoordinates().inViewPort()
This method should return location of the element relative to the top-left corner of whatever OS-window is being used to display the content. Usually it is the browser window's viewport.
This method should try to scroll the page and/or frames to make element visible before calculating its coordinates.
If the element can't be scrolled into view the method should throw an ElementNotVisibleExceptionSGTM. We should add a note that this implementation is designed for users attempting to implement raw native event firing at the OS-level, and that the method isn't generally what users should be using.
On 28 Jan 2013 19:11, "Jason Leyba" <jml...@gmail.com> wrote:
>
> On Mon, Jan 28, 2013 at 1:51 AM, Simon Stewart <simon.m...@gmail.com> wrote:
>>
>> Inline.
>>
>> On Sun, Jan 27, 2013 at 3:16 PM, Alexei Barantsev <bara...@gmail.com> wrote:
>>>
>>> Hi, devs,
>>>
>>> Resuming all comments:
>>>
>>> 1) Method Locatable.getCoordinates().getLocationOnScreen() should be renamed to Locatable.getCoordinates().onScreen()
>>> This method should return location of the element relative to the top-left corner of the monitor (screen)
>>> This method should try to scroll the page and/or frames to make element visible before calculating its coordinates.
>>> If the element can't be scrolled into view the method should throw an ElementNotVisibleException
>>
>>
>> SGTM
>>
>>>
>>> 2) Method Locatable.getCoordinates().getLocationInViewPort() should be renamed to Locatable.getCoordinates().inViewPort()
>>> This method should return location of the element relative to the top-left corner of whatever OS-window is being used to display the content. Usually it is the browser window's viewport.
>>> This method should try to scroll the page and/or frames to make element visible before calculating its coordinates.
>>> If the element can't be scrolled into view the method should throw an ElementNotVisibleException
>>
>>
>> SGTM. We should add a note that this implementation is designed for users attempting to implement raw native event firing at the OS-level, and that the method isn't generally what users should be using.
>
>
> You've got onScreen() and inViewPort() mixed up. onScreen() is required for OS-level events. inViewPort() is a stable location that users should use in their tests.
To be fair, it depends. OnScreen is useful for native events using the awt robot or similar, but os events pumped into the message queue use viewport relative distances.
We might consider renaming viewport as it may not match the DOM view ports. Which is a PITA.
>>> 3) Method Locatable.getCoordinates().getLocationInDOM() should be renamed to Locatable.getCoordinates().onPage()
>>> This method should return location of the element relative to the top-left corner of the page.
>>> This method should NOT scroll the page and/or frames.
>>
>>
>> Emphasis on the "should" :) Implementations are free to implement this any way that feels sane to them.
>>
>>>
>>> 4) Method Locatable.getLocationOnceScrolledIntoView() should be deprecated and removed lately because it is redundant, Locatable.getCoordinates().inViewPort() should be used instead.
>>
>>
>> SGTM.
>>
>>>
>>> 5) Method WebElement.getLocation() should delegate down to Locatable.getCoordinates().onPage()
>>
>>
>> Perfect.
>>
>>>
>>> Any additional comments?
>>
>>
>> None. Thank you!
>>
>> Simon
>
>
> --
> You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to selenium-develo...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
On 28 Jan 2013 19:11, "Jason Leyba" <jml...@gmail.com> wrote:
>
> On Mon, Jan 28, 2013 at 1:51 AM, Simon Stewart <simon.m...@gmail.com> wrote:
>>
>> Inline.
>>
>> On Sun, Jan 27, 2013 at 3:16 PM, Alexei Barantsev <bara...@gmail.com> wrote:
>>>
>>> Hi, devs,
>>>
>>> Resuming all comments:
>>>
>>> 1) Method Locatable.getCoordinates().getLocationOnScreen() should be renamed to Locatable.getCoordinates().onScreen()
>>> This method should return location of the element relative to the top-left corner of the monitor (screen)
>>> This method should try to scroll the page and/or frames to make element visible before calculating its coordinates.
>>> If the element can't be scrolled into view the method should throw an ElementNotVisibleException
>>
>>
>> SGTM
>>
>>>
>>> 2) Method Locatable.getCoordinates().getLocationInViewPort() should be renamed to Locatable.getCoordinates().inViewPort()
>>> This method should return location of the element relative to the top-left corner of whatever OS-window is being used to display the content. Usually it is the browser window's viewport.
>>> This method should try to scroll the page and/or frames to make element visible before calculating its coordinates.
>>> If the element can't be scrolled into view the method should throw an ElementNotVisibleException
>>
>>
>> SGTM. We should add a note that this implementation is designed for users attempting to implement raw native event firing at the OS-level, and that the method isn't generally what users should be using.
>
>
> You've got onScreen() and inViewPort() mixed up. onScreen() is required for OS-level events. inViewPort() is a stable location that users should use in their tests.
Damn phones and their massive but tiny screens. The stable location that tests should use is onPage.
Simon
>>> 3) Method Locatable.getCoordinates().getLocationInDOM() should be renamed to Locatable.getCoordinates().onPage()
>>> This method should return location of the element relative to the top-left corner of the page.
>>> This method should NOT scroll the page and/or frames.
>>
>>
>> Emphasis on the "should" :) Implementations are free to implement this any way that feels sane to them.
>>
>>>
>>> 4) Method Locatable.getLocationOnceScrolledIntoView() should be deprecated and removed lately because it is redundant, Locatable.getCoordinates().inViewPort() should be used instead.
>>
>>
>> SGTM.
>>
>>>
>>> 5) Method WebElement.getLocation() should delegate down to Locatable.getCoordinates().onPage()
>>
>>
>> Perfect.
>>
>>>
>>> Any additional comments?
>>
>>
>> None. Thank you!
>>
>> Simon
>
>