Skip to content

Commit eda884a

Browse files
authored
[java] Convert RemoteWebElement::getLocation and ::getSize from JWP Standard to W3C Standard (#10700)
* [Java] Convert RemoteWebElement::getLocation and ::getSize from JWP Standard to W3C Standard Fixes #10698 as part of #10374 * [java] Fixing RemoteWebElementTest unit tests Co-authored-by: Diego Molina <diemol@users.noreply.github.com> Co-authored-by: Diego Molina <diemol@gmail.com> [skip ci]
1 parent c0d25bc commit eda884a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public boolean isDisplayed() {
326326
@Override
327327
@SuppressWarnings({"unchecked"})
328328
public Point getLocation() {
329-
Response response = execute(DriverCommand.GET_ELEMENT_LOCATION(id));
329+
Response response = execute(DriverCommand.GET_ELEMENT_RECT(id));
330330
Map<String, Object> rawPoint = (Map<String, Object>) response.getValue();
331331
int x = ((Number) rawPoint.get("x")).intValue();
332332
int y = ((Number) rawPoint.get("y")).intValue();
@@ -336,7 +336,7 @@ public Point getLocation() {
336336
@Override
337337
@SuppressWarnings({"unchecked"})
338338
public Dimension getSize() {
339-
Response response = execute(DriverCommand.GET_ELEMENT_SIZE(id));
339+
Response response = execute(DriverCommand.GET_ELEMENT_RECT(id));
340340
Map<String, Object> rawSize = (Map<String, Object>) response.getValue();
341341
int width = ((Number) rawSize.get("width")).intValue();
342342
int height = ((Number) rawSize.get("height")).intValue();

‎java/test/org/openqa/selenium/remote/RemoteWebElementTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@
1717

1818
package org.openqa.selenium.remote;
1919

20-
import static org.assertj.core.api.Assertions.assertThat;
21-
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
22-
import static org.mockito.Mockito.mock;
23-
import static org.openqa.selenium.remote.WebDriverFixture.echoCapabilities;
24-
import static org.openqa.selenium.remote.WebDriverFixture.errorResponder;
25-
import static org.openqa.selenium.remote.WebDriverFixture.exceptionResponder;
26-
import static org.openqa.selenium.remote.WebDriverFixture.nullValueResponder;
27-
import static org.openqa.selenium.remote.WebDriverFixture.valueResponder;
28-
import static org.openqa.selenium.remote.WebDriverFixture.webDriverExceptionResponder;
29-
3020
import com.google.common.collect.ImmutableMap;
3121

3222
import org.junit.Test;
@@ -40,6 +30,16 @@
4030
import org.openqa.selenium.WebDriverException;
4131
import org.openqa.selenium.testing.UnitTests;
4232

33+
import static org.assertj.core.api.Assertions.assertThat;
34+
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
35+
import static org.mockito.Mockito.mock;
36+
import static org.openqa.selenium.remote.WebDriverFixture.echoCapabilities;
37+
import static org.openqa.selenium.remote.WebDriverFixture.errorResponder;
38+
import static org.openqa.selenium.remote.WebDriverFixture.exceptionResponder;
39+
import static org.openqa.selenium.remote.WebDriverFixture.nullValueResponder;
40+
import static org.openqa.selenium.remote.WebDriverFixture.valueResponder;
41+
import static org.openqa.selenium.remote.WebDriverFixture.webDriverExceptionResponder;
42+
4343
@Category(UnitTests.class)
4444
public class RemoteWebElementTest {
4545

@@ -298,7 +298,7 @@ public void canHandleGetLocationCommand() {
298298
assertThat(fixture.element.getLocation()).isEqualTo(new Point(10, 20));
299299

300300
fixture.verifyCommands(
301-
new CommandPayload(DriverCommand.GET_ELEMENT_LOCATION,
301+
new CommandPayload(DriverCommand.GET_ELEMENT_RECT,
302302
ImmutableMap.of("id", fixture.element.getId())));
303303
}
304304

@@ -311,7 +311,7 @@ public void canHandleGetSizeCommand() {
311311

312312
fixture.verifyCommands(
313313
new CommandPayload(
314-
DriverCommand.GET_ELEMENT_SIZE, ImmutableMap.of("id", fixture.element.getId())));
314+
DriverCommand.GET_ELEMENT_RECT, ImmutableMap.of("id", fixture.element.getId())));
315315
}
316316

317317
@Test

0 commit comments

Comments
 (0)