Bug 941132 - getElementPosition not matching webdriver command. r=dburns

This commit is contained in:
Andreas Tolfsen 2014-01-21 13:31:31 -05:00
Родитель 1864d067bf
Коммит fe855f06e6
3 изменённых файлов: 29 добавлений и 13 удалений

Просмотреть файл

@ -148,10 +148,17 @@ class HTMLElement(object):
@property
def location(self):
'''
A dictionary with the x and y location of an element
'''
return self.marionette._send_message('getElementPosition', 'value', id=self.id)
"""Get an element's location on the page.
The returned point will contain the x and y coordinates of the
top left-hand corner of the given element. The point (0,0)
refers to the upper-left corner of the document.
:returns: a dictionary containing x and y as entries
"""
return self.marionette._send_message("getElementLocation", "value", id=self.id)
def value_of_css_property(self, property_name):
'''

Просмотреть файл

@ -151,7 +151,7 @@ function startListeners() {
addMessageListenerId("Marionette:isElementEnabled", isElementEnabled);
addMessageListenerId("Marionette:isElementSelected", isElementSelected);
addMessageListenerId("Marionette:sendKeysToElement", sendKeysToElement);
addMessageListenerId("Marionette:getElementPosition", getElementPosition);
addMessageListenerId("Marionette:getElementLocation", getElementLocation);
addMessageListenerId("Marionette:clearElement", clearElement);
addMessageListenerId("Marionette:switchToFrame", switchToFrame);
addMessageListenerId("Marionette:deleteSession", deleteSession);
@ -251,7 +251,7 @@ function deleteSession(msg) {
removeMessageListenerId("Marionette:isElementEnabled", isElementEnabled);
removeMessageListenerId("Marionette:isElementSelected", isElementSelected);
removeMessageListenerId("Marionette:sendKeysToElement", sendKeysToElement);
removeMessageListenerId("Marionette:getElementPosition", getElementPosition);
removeMessageListenerId("Marionette:getElementLocation", getElementLocation);
removeMessageListenerId("Marionette:clearElement", clearElement);
removeMessageListenerId("Marionette:switchToFrame", switchToFrame);
removeMessageListenerId("Marionette:deleteSession", deleteSession);
@ -1708,11 +1708,11 @@ function sendKeysToElement(msg) {
}
/**
* Get the position of an element
* Get the element's top left-hand corner point.
*/
function getElementPosition(msg) {
function getElementLocation(msg) {
let command_id = msg.json.command_id;
try{
try {
let el = elementManager.getKnownElement(msg.json.id, curFrame);
let rect = el.getBoundingClientRect();

Просмотреть файл

@ -1907,10 +1907,18 @@ MarionetteServerConnection.prototype = {
}
},
getElementPosition: function MDA_getElementPosition(aRequest) {
/**
* Get an element's location on the page.
*
* The returned point will contain the x and y coordinates of the
* top left-hand corner of the given element. The point (0,0)
* refers to the upper-left corner of the document.
*
* @return a point containing x and y coordinates as properties
*/
getElementLocation: function MDA_getElementLocation(aRequest) {
this.command_id = this.getCommandId();
this.sendAsync("getElementPosition",
{ id:aRequest.parameters.id },
this.sendAsync("getElementLocation", {id: aRequest.parameters.id},
this.command_id);
},
@ -2376,7 +2384,8 @@ MarionetteServerConnection.prototype.requestTypes = {
"isElementEnabled": MarionetteServerConnection.prototype.isElementEnabled,
"isElementSelected": MarionetteServerConnection.prototype.isElementSelected,
"sendKeysToElement": MarionetteServerConnection.prototype.sendKeysToElement,
"getElementPosition": MarionetteServerConnection.prototype.getElementPosition,
"getElementLocation": MarionetteServerConnection.protocol.getElementLocation,
"getElementPosition": MarionetteServerConnection.prototype.getElementLocation, // deprecated
"clearElement": MarionetteServerConnection.prototype.clearElement,
"getTitle": MarionetteServerConnection.prototype.getTitle,
"getWindowType": MarionetteServerConnection.prototype.getWindowType,