Skip to content

Update to Selenium 4.33.0 +semver:feature #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<dependency>
<groupId>com.github.aquality-automation</groupId>
<artifactId>aquality-selenium-core</artifactId>
<version>4.5.0</version>
<version>4.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.Event;
import org.openqa.selenium.devtools.HasDevTools;
import org.openqa.selenium.devtools.v85.performance.Performance;
import org.openqa.selenium.devtools.v85.performance.model.Metric;
import org.openqa.selenium.devtools.v137.performance.Performance;
import org.openqa.selenium.devtools.v137.performance.model.Metric;

import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.v85.dom.model.RGBA;
import org.openqa.selenium.devtools.v85.emulation.Emulation;
import org.openqa.selenium.devtools.v85.emulation.model.MediaFeature;
import org.openqa.selenium.devtools.v85.emulation.model.ScreenOrientation;
import org.openqa.selenium.devtools.v137.dom.model.RGBA;
import org.openqa.selenium.devtools.v137.emulation.Emulation;
import org.openqa.selenium.devtools.v137.emulation.model.MediaFeature;
import org.openqa.selenium.devtools.v137.emulation.model.ScreenOrientation;

import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -45,7 +45,8 @@ public boolean canEmulate() {
* @param accuracy Accuracy of the location
*/
public void setGeolocationOverride(double latitude, double longitude, double accuracy) {
setGeolocationOverride(Optional.of(latitude), Optional.of(longitude), Optional.of(accuracy));
setGeolocationOverride(Optional.of(latitude), Optional.of(longitude), Optional.of(accuracy), Optional.empty(),
Optional.empty(), Optional.empty(), Optional.empty());
}

/**
Expand All @@ -64,8 +65,10 @@ public void setGeolocationOverride(double latitude, double longitude) {
* @param longitude Longitude of location
* @param accuracy Accuracy of the location
*/
public void setGeolocationOverride(Optional<Number> latitude, Optional<Number> longitude, Optional<Number> accuracy) {
tools.sendCommand(Emulation.setGeolocationOverride(latitude, longitude, accuracy));
public void setGeolocationOverride(Optional<Number> latitude, Optional<Number> longitude, Optional<Number> accuracy,
Optional<Number> altitude, Optional<Number> altitudeAccuracy, Optional<Number> heading,
Optional<Number> speed) {
tools.sendCommand(Emulation.setGeolocationOverride(latitude, longitude, accuracy, altitude, altitudeAccuracy, heading, speed));
}

/**
Expand Down Expand Up @@ -115,7 +118,7 @@ public void setDeviceMetricsOverride(Integer width, Integer height, Number devic
screenOrientation = Optional.of(new ScreenOrientation(ScreenOrientation.Type.fromString(screenOrientationType.get()), angle));
}
tools.sendCommand(Emulation.setDeviceMetricsOverride(width, height, deviceScaleFactor, mobile, Optional.empty(), Optional.empty(), Optional.empty(),
Optional.empty(), Optional.empty(), Optional.empty(), screenOrientation, Optional.empty()));
Optional.empty(), Optional.empty(), Optional.empty(), screenOrientation, Optional.empty(), Optional.empty(), Optional.empty()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import org.openqa.selenium.devtools.idealized.Javascript;
import org.openqa.selenium.devtools.idealized.ScriptId;
import org.openqa.selenium.devtools.idealized.target.model.SessionID;
import org.openqa.selenium.devtools.v85.page.Page;
import org.openqa.selenium.devtools.v85.page.model.ScriptIdentifier;
import org.openqa.selenium.devtools.v85.runtime.Runtime;
import org.openqa.selenium.devtools.v137.page.Page;
import org.openqa.selenium.devtools.v137.page.model.ScriptIdentifier;
import org.openqa.selenium.devtools.v137.runtime.Runtime;
import org.openqa.selenium.logging.EventType;
import org.openqa.selenium.logging.HasLogEvents;
import org.openqa.selenium.remote.Augmenter;
Expand Down Expand Up @@ -55,7 +55,7 @@ public JavaScriptHandling(DevToolsHandling tools) {
public void addScriptCallbackBinding(String scriptName) {
logger.info("loc.browser.javascript.scriptcallbackbinding.add", scriptName);
bindings.add(scriptName);
tools.sendCommand(Runtime.addBinding(scriptName, Optional.empty()));
tools.sendCommand(Runtime.addBinding(scriptName, Optional.empty(), Optional.empty()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.openqa.selenium.UsernameAndPassword;
import org.openqa.selenium.devtools.NetworkInterceptor;
import org.openqa.selenium.devtools.idealized.Network;
import org.openqa.selenium.devtools.v85.network.model.*;
import org.openqa.selenium.devtools.v137.network.model.*;
import org.openqa.selenium.remote.http.*;

import java.net.URI;
Expand All @@ -22,11 +22,11 @@

import static aquality.selenium.browser.AqualityServices.getBrowser;
import static aquality.selenium.logging.LocalizedLoggerUtility.logByLevel;
import static org.openqa.selenium.devtools.v85.network.Network.*;
import static org.openqa.selenium.devtools.v137.network.Network.*;

/**
* DevTools commands for version-independent network interception.
* For more information, see {@link org.openqa.selenium.devtools.v85.network.Network} and {@link Network}.
* For more information, see {@link org.openqa.selenium.devtools.v137.network.Network} and {@link Network}.
*/
public class NetworkHandling {
public static final String LOC_NETWORK_INTERCEPTOR_START = "loc.browser.network.interceptor.start";
Expand Down Expand Up @@ -199,7 +199,7 @@ private Consumer<ResponseReceived> getResponseLogger(HttpExchangeLoggingOptions
formatHeaders(response.getHeaders()));
}
if (loggingOptions.getResponseBody().isEnabled()) {
String responseBody = tools.sendCommand(org.openqa.selenium.devtools.v85.network.Network.getResponseBody(requestId)).getBody();
String responseBody = tools.sendCommand(org.openqa.selenium.devtools.v137.network.Network.getResponseBody(requestId)).getBody();
if (StringUtils.isNotEmpty(responseBody)) {
logByLevel(loggingOptions.getResponseBody().getLogLevel(),
"loc.browser.network.event.responsereceived.log.body",
Expand Down Expand Up @@ -323,7 +323,8 @@ public void clearNetworkInterceptor() {
*/
public void emulateConditions(Boolean offline, Number latency, Number downloadThroughput, Number uploadThroughput) {
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty()));
tools.sendCommand(emulateNetworkConditions(offline, latency, downloadThroughput, uploadThroughput, Optional.empty()));
tools.sendCommand(emulateNetworkConditions(offline, latency, downloadThroughput, uploadThroughput, Optional.empty(),
Optional.empty(), Optional.empty(), Optional.empty()));
}

/**
Expand All @@ -339,6 +340,6 @@ public void emulateConditions(Boolean offline, Number latency, Number downloadTh
public void emulateConditions(Boolean offline, Number latency, Number downloadThroughput, Number uploadThroughput, String connectionType) {
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty()));
tools.sendCommand(emulateNetworkConditions(offline, latency, downloadThroughput, uploadThroughput,
Optional.of(ConnectionType.fromString(connectionType))));
Optional.of(ConnectionType.fromString(connectionType)), Optional.empty(), Optional.empty(), Optional.empty()));
}
}
82 changes: 5 additions & 77 deletions src/test/java/automationpractice/forms/ChallengingDomForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,89 +7,17 @@
public class ChallengingDomForm extends Form {

public static final String LOCATOR_CHALLENGING_DOM_FORM = "//h3[contains(text(),'Challenging DOM')]";
public static final String ELEMENT_NAME_ROW3_COLUMN5 = "Cell in row 3 column 5";
public static final String ELEMENT_NAME_ROW5_COLUMN5 = "Cell in row 5 column 5";
public static final String ELEMENT_NAME_ROW7_COLUMN5 = "Cell in row 7 column 5";
public static final String ELEMENT_NAME_ROW5_COLUMN7 = "Cell in row 5 column 7";
public static final String ELEMENT_NAME_ROW5_COLUMN3 = "Cell in row 5 column 3";
public static final String ELEMENT_NAME_ROW1_COLUMN1 = "Cell in row 1 column 1";
public static final String ELEMENT_NAME_ROW2_COLUMN1 = "Cell in row 2 column 1";
public static final String ELEMENT_NAME_HEADER_CHALLENGING_DOM = "Header of Challenging Dom";

private final String locatorCellRow5Column5 = "//tr[5]/td[5]";
private final String locatorCellRow3Column5 = "//tr[3]/td[5]";
private final String locatorCellRow7Column5 = "//tr[7]/td[5]";
private final String locatorCellRow5Column3 = "//tr[5]/td[3]";
private final String locatorCellRow5Column7 = "//tr[5]/td[7]";
private final String locatorCellRow1Column1 = "//tr[1]/td[1]";
private final String locatorCellRow2Column1 = "//tr[2]/td[1]";

private ILabel headerName = getElementFactory().getLabel(By.xpath(LOCATOR_CHALLENGING_DOM_FORM), ELEMENT_NAME_HEADER_CHALLENGING_DOM);
private ILabel cellInRow3Column5 = getElementFactory().getLabel(By.xpath(locatorCellRow3Column5), ELEMENT_NAME_ROW3_COLUMN5);
private ILabel cellInRow5Column5 = getElementFactory().getLabel(By.xpath(locatorCellRow5Column5), ELEMENT_NAME_ROW5_COLUMN5);
private ILabel cellInRow7Column5 = getElementFactory().getLabel(By.xpath(locatorCellRow7Column5), ELEMENT_NAME_ROW7_COLUMN5);
private ILabel cellInRow5Column7 = getElementFactory().getLabel(By.xpath(locatorCellRow5Column7), ELEMENT_NAME_ROW5_COLUMN7);
private ILabel cellInRow5Column3 = getElementFactory().getLabel(By.xpath(locatorCellRow5Column3), ELEMENT_NAME_ROW5_COLUMN3);
private ILabel cellInRow1Column1 = getElementFactory().getLabel(By.xpath(locatorCellRow1Column1), ELEMENT_NAME_ROW1_COLUMN1);
private ILabel cellInRow2Column1 = getElementFactory().getLabel(By.xpath(locatorCellRow2Column1), ELEMENT_NAME_ROW2_COLUMN1);

public ChallengingDomForm() {
super(By.xpath(LOCATOR_CHALLENGING_DOM_FORM), "Challenging DOM");
}

public ILabel getCellInRow3Column5() {
return cellInRow3Column5;
super(By.xpath(LOCATOR_CHALLENGING_DOM_FORM), "Challenging Dom");
}

public ILabel getCellInRow5Column5() {
return cellInRow5Column5;
public String getHeaderText() {
return getFormLabel().getText();
}

public ILabel getCellInRow7Column5() {
return cellInRow7Column5;
public ILabel getCell(int row, int column) {
return getElementFactory().getLabel(By.xpath(String.format("//tr[%d]/td[%d]", row, column)), String.format("Cell at row %d and column %d", row, column));
}

public ILabel getCellInRow5Column7() {
return cellInRow5Column7;
}

public ILabel getCellInRow5Column3() {
return cellInRow5Column3;
}

public ILabel getCellInRow1Column1() {
return cellInRow1Column1;
}

public ILabel getCellInRow2Column1() {
return cellInRow2Column1;
}

public ILabel getHeaderName() {
return headerName;
}

public String getLocatorCellRow1Column1() {
return locatorCellRow1Column1;
}

public String getLocatorCellRow5Column5() {
return locatorCellRow5Column5;
}

public String getLocatorCellRow3Column5() {
return locatorCellRow3Column5;
}

public String getLocatorCellRow7Column5() {
return locatorCellRow7Column5;
}

public String getLocatorCellRow5Column3() {
return locatorCellRow5Column3;
}

public String getLocatorCellRow5Column7() {
return locatorCellRow5Column7;
}
}
7 changes: 7 additions & 0 deletions src/test/java/manytools/ManyToolsForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import aquality.selenium.browser.AqualityServices;
import aquality.selenium.core.utilities.IActionRetrier;
import aquality.selenium.elements.interfaces.IButton;
import aquality.selenium.elements.interfaces.ILabel;
import aquality.selenium.forms.Form;
import org.openqa.selenium.By;
Expand All @@ -12,6 +13,7 @@
public abstract class ManyToolsForm<T extends ManyToolsForm<T>> extends Form {
private static final String BASE_URL = "https://manytools.org/";
private final ILabel lblValue = getFormLabel().findChildElement(By.xpath(".//code"), getName(), ILabel.class);
private final IButton btnAgree = getElementFactory().getButton(By.xpath("//button[@mode='primary']"), "Agree");

protected ManyToolsForm(String name) {
super(By.id("maincontent"), name);
Expand All @@ -24,6 +26,11 @@ public T open() {
AqualityServices.get(IActionRetrier.class).doWithRetry(() -> {
AqualityServices.getBrowser().goTo(BASE_URL + getUrlPart());
AqualityServices.getBrowser().waitForPageToLoad();
if (btnAgree.state().isDisplayed())
{
btnAgree.click();
btnAgree.state().waitForNotDisplayed();
}
}, Collections.singletonList(TimeoutException.class));
return (T) this;
}
Expand Down
Loading
Loading