Skip to content

Commit 291a487

Browse files
committed
getElementLocation and getElementSize are not aliases for getElementRect
Though in the w3c remote ends, it turns out that they are.
1 parent cffa6a8 commit 291a487

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

java/client/src/org/openqa/selenium/remote/RemoteWebElement.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public boolean isDisplayed() {
333333

334334
@SuppressWarnings({"unchecked"})
335335
public Point getLocation() {
336-
Response response = execute(DriverCommand.GET_ELEMENT_RECT, ImmutableMap.of("id", id));
336+
Response response = execute(DriverCommand.GET_ELEMENT_LOCATION, ImmutableMap.of("id", id));
337337
Map<String, Object> rawPoint = (Map<String, Object>) response.getValue();
338338
int x = ((Number) rawPoint.get("x")).intValue();
339339
int y = ((Number) rawPoint.get("y")).intValue();
@@ -342,7 +342,7 @@ public Point getLocation() {
342342

343343
@SuppressWarnings({"unchecked"})
344344
public Dimension getSize() {
345-
Response response = execute(DriverCommand.GET_ELEMENT_RECT, ImmutableMap.of("id", id));
345+
Response response = execute(DriverCommand.GET_ELEMENT_SIZE, ImmutableMap.of("id", id));
346346
Map<String, Object> rawSize = (Map<String, Object>) response.getValue();
347347
int width = ((Number) rawSize.get("width")).intValue();
348348
int height = ((Number) rawSize.get("height")).intValue();

java/client/src/org/openqa/selenium/remote/http/W3CHttpCommandCodec.java

+5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
import static org.openqa.selenium.remote.DriverCommand.GET_CURRENT_WINDOW_POSITION;
3131
import static org.openqa.selenium.remote.DriverCommand.GET_CURRENT_WINDOW_SIZE;
3232
import static org.openqa.selenium.remote.DriverCommand.GET_ELEMENT_ATTRIBUTE;
33+
import static org.openqa.selenium.remote.DriverCommand.GET_ELEMENT_LOCATION;
3334
import static org.openqa.selenium.remote.DriverCommand.GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW;
35+
import static org.openqa.selenium.remote.DriverCommand.GET_ELEMENT_RECT;
36+
import static org.openqa.selenium.remote.DriverCommand.GET_ELEMENT_SIZE;
3437
import static org.openqa.selenium.remote.DriverCommand.GET_PAGE_SOURCE;
3538
import static org.openqa.selenium.remote.DriverCommand.GET_WINDOW_HANDLES;
3639
import static org.openqa.selenium.remote.DriverCommand.IS_ELEMENT_DISPLAYED;
@@ -63,7 +66,9 @@ public class W3CHttpCommandCodec extends AbstractHttpCommandCodec {
6366

6467
public W3CHttpCommandCodec() {
6568
alias(GET_ELEMENT_ATTRIBUTE, EXECUTE_SCRIPT);
69+
alias(GET_ELEMENT_LOCATION, GET_ELEMENT_RECT);
6670
alias(GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW, EXECUTE_SCRIPT);
71+
alias(GET_ELEMENT_SIZE, GET_ELEMENT_RECT);
6772
alias(IS_ELEMENT_DISPLAYED, EXECUTE_SCRIPT);
6873
alias(SUBMIT_ELEMENT, EXECUTE_SCRIPT);
6974

0 commit comments

Comments
 (0)