Skip to content

Commit d083512

Browse files
authored
Update to Selenium 4.43.0 +semver:feature (#160)
Update to Selenium 4.43.0 +semver:feature Update plugins and dependencies versions. Update DevTools references. Add new signature of method to setDeviceMetricsOverride with more parameters
1 parent a2cf75c commit d083512

8 files changed

Lines changed: 51 additions & 20 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<dependency>
7171
<groupId>com.github.aquality-automation</groupId>
7272
<artifactId>aquality-selenium-core</artifactId>
73-
<version>4.13.0</version>
73+
<version>4.14.0</version>
7474
</dependency>
7575
<dependency>
7676
<groupId>org.apache.commons</groupId>

src/main/java/aquality/selenium/browser/devtools/DevToolsHandling.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import org.openqa.selenium.devtools.DevTools;
1010
import org.openqa.selenium.devtools.Event;
1111
import org.openqa.selenium.devtools.HasDevTools;
12-
import org.openqa.selenium.devtools.v145.performance.Performance;
13-
import org.openqa.selenium.devtools.v145.performance.model.Metric;
12+
import org.openqa.selenium.devtools.v147.performance.Performance;
13+
import org.openqa.selenium.devtools.v147.performance.model.Metric;
1414

1515
import java.util.List;
1616
import java.util.Map;

src/main/java/aquality/selenium/browser/devtools/EmulationHandling.java

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
import org.apache.commons.lang3.StringUtils;
44
import org.openqa.selenium.devtools.Command;
5-
import org.openqa.selenium.devtools.v145.dom.model.RGBA;
6-
import org.openqa.selenium.devtools.v145.emulation.Emulation;
7-
import org.openqa.selenium.devtools.v145.emulation.model.MediaFeature;
8-
import org.openqa.selenium.devtools.v145.emulation.model.ScreenOrientation;
5+
import org.openqa.selenium.devtools.v147.dom.model.RGBA;
6+
import org.openqa.selenium.devtools.v147.emulation.Emulation;
7+
import org.openqa.selenium.devtools.v147.emulation.model.DevicePosture;
8+
import org.openqa.selenium.devtools.v147.emulation.model.DisplayFeature;
9+
import org.openqa.selenium.devtools.v147.emulation.model.MediaFeature;
10+
import org.openqa.selenium.devtools.v147.emulation.model.ScreenOrientation;
11+
import org.openqa.selenium.devtools.v147.page.model.Viewport;
912

1013
import java.util.Collections;
1114
import java.util.List;
@@ -130,8 +133,36 @@ public void setDeviceMetricsOverride(Integer width, Integer height, Number devic
130133
}
131134
screenOrientation = Optional.of(new ScreenOrientation(ScreenOrientation.Type.fromString(screenOrientationType.get()), angle));
132135
}
133-
tools.sendCommand(Emulation.setDeviceMetricsOverride(width, height, deviceScaleFactor, mobile, Optional.empty(), Optional.empty(), Optional.empty(),
134-
Optional.empty(), Optional.empty(), Optional.empty(), screenOrientation, Optional.empty(), Optional.empty(), Optional.empty()));
136+
setDeviceMetricsOverride(width, height, deviceScaleFactor, mobile, Optional.empty(),
137+
Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(),
138+
Optional.empty(), screenOrientation, Optional.empty(), Optional.empty(),
139+
Optional.empty(), Optional.empty(), Optional.empty());
140+
}
141+
142+
/**
143+
* Overrides the values of device screen dimensions.
144+
*
145+
* @param width Value to override window.screen.width
146+
* @param height Value to override window.screen.height
147+
* @param deviceScaleFactor Overriding device scale factor value. 0 disables the override.
148+
* @param mobile Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text auto-sizing and more.
149+
* @param scale Scale to apply to resulting view image. Ignored if |dontSetVisibleSize| is set.
150+
* @param screenWidth Value to override window.screen.width. Ignored if |dontSetVisibleSize| is set.
151+
* @param screenHeight Value to override window.screen.height. Ignored if |dontSetVisibleSize| is set.
152+
* @param positionX Overriding view X position on screen in device independent pixels (dip). Ignored if |dontSetVisibleSize| is set.
153+
* @param positionY Overriding view Y position on screen in device independent pixels (dip). Ignored if |dontSetVisibleSize| is set.
154+
* @param dontSetVisibleSize Whether to not set visible view size, rely upon explicit setVisibleSize call. Ignored if |scale| is set.
155+
* @param screenOrientation Orientation of the screen. Ignored if |dontSetVisibleSize| is set.
156+
* @param viewport If set, the visible area of the overridden device screen, not affecting the reported screen size. Ignored if |dontSetVisibleSize| is set.
157+
* @param displayFeature Configuration of the display when the system is in unified mode (e.g., foldable devices).
158+
* @param devicePosture The posture of the device (e.g., foldable devices).
159+
* @param scrollbarType The type of the scrollbars to render (e.g., mobile vs desktop). Ignored if |dontSetVisibleSize| is set.
160+
* @param screenOrientationLockEmulation Enables screen orientation lock emulation that intercepts calls to screen.orientation.lock().
161+
*/
162+
public void setDeviceMetricsOverride(Integer width, Integer height, Number deviceScaleFactor, Boolean mobile, Optional<Number> scale, Optional<Integer> screenWidth, Optional<Integer> screenHeight, Optional<Integer> positionX, Optional<Integer> positionY, Optional<Boolean> dontSetVisibleSize, Optional<ScreenOrientation> screenOrientation, Optional<Viewport> viewport, Optional<DisplayFeature> displayFeature, Optional<DevicePosture> devicePosture, Optional<Emulation.SetDeviceMetricsOverrideScrollbarType> scrollbarType, Optional<Boolean> screenOrientationLockEmulation) {
163+
tools.sendCommand(Emulation.setDeviceMetricsOverride(width, height, deviceScaleFactor, mobile, scale, screenWidth,
164+
screenHeight, positionX, positionY, dontSetVisibleSize, screenOrientation, viewport, displayFeature,
165+
devicePosture, scrollbarType, screenOrientationLockEmulation));
135166
}
136167

137168
/**

src/main/java/aquality/selenium/browser/devtools/JavaScriptHandling.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import org.openqa.selenium.devtools.idealized.Javascript;
1313
import org.openqa.selenium.devtools.idealized.ScriptId;
1414
import org.openqa.selenium.devtools.idealized.target.model.SessionID;
15-
import org.openqa.selenium.devtools.v145.page.Page;
16-
import org.openqa.selenium.devtools.v145.page.model.ScriptIdentifier;
17-
import org.openqa.selenium.devtools.v145.runtime.Runtime;
15+
import org.openqa.selenium.devtools.v147.page.Page;
16+
import org.openqa.selenium.devtools.v147.page.model.ScriptIdentifier;
17+
import org.openqa.selenium.devtools.v147.runtime.Runtime;
1818
import org.openqa.selenium.logging.EventType;
1919
import org.openqa.selenium.logging.HasLogEvents;
2020
import org.openqa.selenium.remote.Augmenter;

src/main/java/aquality/selenium/browser/devtools/NetworkHandling.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.openqa.selenium.UsernameAndPassword;
99
import org.openqa.selenium.devtools.NetworkInterceptor;
1010
import org.openqa.selenium.devtools.idealized.Network;
11-
import org.openqa.selenium.devtools.v145.network.model.*;
11+
import org.openqa.selenium.devtools.v147.network.model.*;
1212
import org.openqa.selenium.remote.http.*;
1313

1414
import java.net.URI;
@@ -22,11 +22,11 @@
2222

2323
import static aquality.selenium.browser.AqualityServices.getBrowser;
2424
import static aquality.selenium.logging.LocalizedLoggerUtility.logByLevel;
25-
import static org.openqa.selenium.devtools.v145.network.Network.*;
25+
import static org.openqa.selenium.devtools.v147.network.Network.*;
2626

2727
/**
2828
* DevTools commands for version-independent network interception.
29-
* For more information, see {@link org.openqa.selenium.devtools.v145.network.Network} and {@link Network}.
29+
* For more information, see {@link org.openqa.selenium.devtools.v147.network.Network} and {@link Network}.
3030
*/
3131
public class NetworkHandling {
3232
public static final String LOC_NETWORK_INTERCEPTOR_START = "loc.browser.network.interceptor.start";

src/test/java/tests/usecases/devtools/DeviceEmulationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import aquality.selenium.browser.AqualityServices;
44
import aquality.selenium.browser.devtools.EmulationHandling;
55
import com.google.common.collect.ImmutableMap;
6-
import org.openqa.selenium.devtools.v144.emulation.Emulation;
7-
import org.openqa.selenium.devtools.v144.emulation.model.DisplayFeature;
6+
import org.openqa.selenium.devtools.v146.emulation.Emulation;
7+
import org.openqa.selenium.devtools.v146.emulation.model.DisplayFeature;
88
import org.testng.Assert;
99
import org.testng.annotations.BeforeMethod;
1010
import org.testng.annotations.Test;

src/test/java/tests/usecases/devtools/NetworkSpeedEmulationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import aquality.selenium.browser.AqualityServices;
44
import aquality.selenium.browser.devtools.NetworkHandling;
55
import org.openqa.selenium.TimeoutException;
6-
import org.openqa.selenium.devtools.v145.network.model.ConnectionType;
7-
import org.openqa.selenium.devtools.v145.network.model.NetworkConditions;
6+
import org.openqa.selenium.devtools.v147.network.model.ConnectionType;
7+
import org.openqa.selenium.devtools.v147.network.model.NetworkConditions;
88
import org.testng.Assert;
99
import org.testng.annotations.Test;
1010
import tests.BaseTest;

src/test/java/tests/usecases/devtools/OverrideUserAgentTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import manytools.BrowserLanguageForm;
99
import manytools.UserAgentForm;
1010
import org.openqa.selenium.devtools.idealized.Network;
11-
import org.openqa.selenium.devtools.v144.emulation.Emulation;
11+
import org.openqa.selenium.devtools.v146.emulation.Emulation;
1212
import org.testng.Assert;
1313
import org.testng.annotations.BeforeMethod;
1414
import org.testng.annotations.Test;

0 commit comments

Comments
 (0)