From 73fcbfe99c3ca798951b0c20ebf6b57049991090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alaksiej=20Miale=C5=A1ka?= Date: Wed, 21 Oct 2026 13:09:34 +0200 Subject: [PATCH 1/2] Update Selenium to 4.50.0 +semver:feature Update package dependencies: guava to 33.7.1, jackson-databind to 2.22.3 (yet), appium to 11.0.0 (in tests), commons-lang3 to 3.21.0 --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index d5568c5..2125985 100644 --- a/pom.xml +++ b/pom.xml @@ -109,28 +109,28 @@ com.google.guava guava - 33.6.0-jre + 33.7.1-jre com.fasterxml.jackson.core jackson-databind - 2.22.2 + 2.22.3 org.seleniumhq.selenium selenium-java - 4.49.0 + 4.50.0 io.appium java-client - 10.1.1 + 11.0.0 test org.apache.commons commons-lang3 - 3.20.0 + 3.21.0 test From d8cbad84ebdc98693e06c2c120fdf0d15258c2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alaksiej=20Miale=C5=A1ka?= Date: Wed, 21 Oct 2026 14:48:37 +0200 Subject: [PATCH 2/2] migrate from RemoteWebDriver to WebDriver and from RemoteWebElement to WebElement +semver:breaking Complete the Appium 11 source migration --- .../core/applications/IApplication.java | 4 ++-- .../elements/CachedElementStateProvider.java | 2 +- .../selenium/core/elements/Element.java | 6 +++--- .../core/elements/ElementCacheHandler.java | 8 ++++---- .../core/elements/interfaces/IElement.java | 10 +++++----- .../interfaces/IElementCacheHandler.java | 20 +++++++++---------- .../core/visualization/ImageFunctions.java | 4 ++-- .../visualization/VisualStateProvider.java | 8 ++++---- .../tests/applications/ICachedElement.java | 6 +++--- .../browser/ChromeApplication.java | 3 ++- .../windowsApp/WindowsApplication.java | 4 ++-- .../tests/elements/CachedWebElementTests.java | 9 +++++---- .../elements/CachedWindowsElementTests.java | 17 ++++++++-------- .../tests/elements/ICachedElementTests.java | 2 +- .../java/tests/elements/WebElementTests.java | 10 +++++----- .../tests/elements/WindowsElementTests.java | 10 +++++----- 16 files changed, 63 insertions(+), 60 deletions(-) diff --git a/src/main/java/aquality/selenium/core/applications/IApplication.java b/src/main/java/aquality/selenium/core/applications/IApplication.java index f3fc5a4..5bfaaf3 100644 --- a/src/main/java/aquality/selenium/core/applications/IApplication.java +++ b/src/main/java/aquality/selenium/core/applications/IApplication.java @@ -1,6 +1,6 @@ package aquality.selenium.core.applications; -import org.openqa.selenium.remote.RemoteWebDriver; +import org.openqa.selenium.WebDriver; import java.time.Duration; @@ -12,7 +12,7 @@ public interface IApplication { /** * @return Current instance of driver. */ - RemoteWebDriver getDriver(); + WebDriver getDriver(); /** * @return Is the application already running or not. diff --git a/src/main/java/aquality/selenium/core/elements/CachedElementStateProvider.java b/src/main/java/aquality/selenium/core/elements/CachedElementStateProvider.java index 331d6e7..c2721d7 100644 --- a/src/main/java/aquality/selenium/core/elements/CachedElementStateProvider.java +++ b/src/main/java/aquality/selenium/core/elements/CachedElementStateProvider.java @@ -17,7 +17,7 @@ import java.util.function.Predicate; /** - * Provides functions to retrive the state for cached element. + * Provides functions to retrieve the state for cached element. */ public class CachedElementStateProvider extends ElementStateProvider { diff --git a/src/main/java/aquality/selenium/core/elements/Element.java b/src/main/java/aquality/selenium/core/elements/Element.java index 63e24c4..1da665d 100644 --- a/src/main/java/aquality/selenium/core/elements/Element.java +++ b/src/main/java/aquality/selenium/core/elements/Element.java @@ -17,7 +17,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriverException; -import org.openqa.selenium.remote.RemoteWebElement; +import org.openqa.selenium.WebElement; import java.time.Duration; import java.util.List; @@ -104,11 +104,11 @@ public IVisualStateProvider visual() { } @Override - public RemoteWebElement getElement(Duration timeout) { + public WebElement getElement(Duration timeout) { try { return getElementCacheConfiguration().isEnabled() ? getCache().getElement(timeout) - : (RemoteWebElement) getElementFinder().findElement(locator, elementState, timeout); + : getElementFinder().findElement(locator, elementState, timeout); } catch (NoSuchElementException e) { if (getLoggerConfiguration().logPageSource()) { logPageSource(e); diff --git a/src/main/java/aquality/selenium/core/elements/ElementCacheHandler.java b/src/main/java/aquality/selenium/core/elements/ElementCacheHandler.java index 11a6123..3139c6d 100644 --- a/src/main/java/aquality/selenium/core/elements/ElementCacheHandler.java +++ b/src/main/java/aquality/selenium/core/elements/ElementCacheHandler.java @@ -3,7 +3,7 @@ import aquality.selenium.core.elements.interfaces.IElementCacheHandler; import aquality.selenium.core.elements.interfaces.IElementFinder; import org.openqa.selenium.By; -import org.openqa.selenium.remote.RemoteWebElement; +import org.openqa.selenium.WebElement; import java.time.Duration; @@ -16,7 +16,7 @@ public class ElementCacheHandler implements IElementCacheHandler { private final ElementState state; private final IElementFinder finder; - private RemoteWebElement remoteElement; + private WebElement remoteElement; public ElementCacheHandler(By locator, ElementState state, IElementFinder finder) { this.locator = locator; @@ -46,10 +46,10 @@ public boolean wasCached() { } @Override - public RemoteWebElement getElement(Duration timeout, ElementState customState) { + public WebElement getElement(Duration timeout, ElementState customState) { ElementState requiredState = customState == null ? state : customState; if (isRefreshNeeded(requiredState)) { - remoteElement = (RemoteWebElement) finder.findElement(locator, requiredState, timeout); + remoteElement = finder.findElement(locator, requiredState, timeout); } return remoteElement; diff --git a/src/main/java/aquality/selenium/core/elements/interfaces/IElement.java b/src/main/java/aquality/selenium/core/elements/interfaces/IElement.java index ddf509a..204bda2 100644 --- a/src/main/java/aquality/selenium/core/elements/interfaces/IElement.java +++ b/src/main/java/aquality/selenium/core/elements/interfaces/IElement.java @@ -2,7 +2,7 @@ import aquality.selenium.core.visualization.IVisualStateProvider; import org.openqa.selenium.By; -import org.openqa.selenium.remote.RemoteWebElement; +import org.openqa.selenium.WebElement; import java.time.Duration; @@ -39,9 +39,9 @@ public interface IElement extends IParent { * Default timeout is provided in {@link aquality.selenium.core.configurations.ITimeoutConfiguration} * {@link org.openqa.selenium.NoSuchElementException} throws if element not found * - * @return instance of {@link RemoteWebElement} if found. + * @return instance of {@link WebElement} if found. */ - default RemoteWebElement getElement() { + default WebElement getElement() { return getElement(null); } @@ -50,9 +50,9 @@ default RemoteWebElement getElement() { * {@link org.openqa.selenium.NoSuchElementException} throws if element not found * * @param timeout Timeout for waiting - * @return instance of {@link RemoteWebElement} if found. + * @return instance of {@link WebElement} if found. */ - RemoteWebElement getElement(Duration timeout); + WebElement getElement(Duration timeout); /** * Gets the item text (inner text). diff --git a/src/main/java/aquality/selenium/core/elements/interfaces/IElementCacheHandler.java b/src/main/java/aquality/selenium/core/elements/interfaces/IElementCacheHandler.java index e384b9b..eee14d9 100644 --- a/src/main/java/aquality/selenium/core/elements/interfaces/IElementCacheHandler.java +++ b/src/main/java/aquality/selenium/core/elements/interfaces/IElementCacheHandler.java @@ -1,7 +1,7 @@ package aquality.selenium.core.elements.interfaces; import aquality.selenium.core.elements.ElementState; -import org.openqa.selenium.remote.RemoteWebElement; +import org.openqa.selenium.WebElement; import java.time.Duration; @@ -22,7 +22,7 @@ default boolean isRefreshNeeded() { /** * Determines is the cached element refresh needed. * - * @param customState custom element's existance state used for search. + * @param customState custom element's existence state used for search. * @return true if the refresh is needed (element wasn't found previously or is stale), false otherwise. */ boolean isRefreshNeeded(ElementState customState); @@ -46,29 +46,29 @@ default boolean isStale() { /** * Allows to get cached element. * - * @param timeout timeout used to retrive the element when {@link #isRefreshNeeded()} is true. - * @param customState custom element's existance state used for search. + * @param timeout timeout used to retrieve the element when {@link #isRefreshNeeded()} is true. + * @param customState custom element's existence state used for search. * @return cached element. */ - RemoteWebElement getElement(Duration timeout, ElementState customState); + WebElement getElement(Duration timeout, ElementState customState); /** * Allows to get cached element. * - * @param timeout timeout used to retrive the element when {@link #isRefreshNeeded()} is true. + * @param timeout timeout used to retrieve the element when {@link #isRefreshNeeded()} is true. * @return cached element. */ - default RemoteWebElement getElement(Duration timeout) { + default WebElement getElement(Duration timeout) { return getElement(timeout, null); } /** * Allows to get cached element. * - * @param customState custom element's existance state used for search. + * @param customState custom element's existence state used for search. * @return cached element. */ - default RemoteWebElement getElement(ElementState customState) { + default WebElement getElement(ElementState customState) { return getElement(null, customState); } @@ -77,7 +77,7 @@ default RemoteWebElement getElement(ElementState customState) { * * @return cached element. */ - default RemoteWebElement getElement() { + default WebElement getElement() { return getElement(null, null); } } diff --git a/src/main/java/aquality/selenium/core/visualization/ImageFunctions.java b/src/main/java/aquality/selenium/core/visualization/ImageFunctions.java index 4d0d825..ef46c25 100644 --- a/src/main/java/aquality/selenium/core/visualization/ImageFunctions.java +++ b/src/main/java/aquality/selenium/core/visualization/ImageFunctions.java @@ -3,7 +3,7 @@ import aquality.selenium.core.elements.interfaces.IElement; import aquality.selenium.core.logging.Logger; import org.openqa.selenium.OutputType; -import org.openqa.selenium.remote.RemoteWebElement; +import org.openqa.selenium.WebElement; import javax.imageio.ImageIO; import java.awt.*; @@ -52,7 +52,7 @@ public static BufferedImage getScreenshotAsImage(IElement element) { * @param element given element. * @return image object. */ - public static BufferedImage getScreenshotAsImage(RemoteWebElement element) { + public static BufferedImage getScreenshotAsImage(WebElement element) { byte[] bytes = element.getScreenshotAs(OutputType.BYTES); try (InputStream is = new ByteArrayInputStream(bytes)) { return ImageIO.read(is); diff --git a/src/main/java/aquality/selenium/core/visualization/VisualStateProvider.java b/src/main/java/aquality/selenium/core/visualization/VisualStateProvider.java index f076926..1de6bf2 100644 --- a/src/main/java/aquality/selenium/core/visualization/VisualStateProvider.java +++ b/src/main/java/aquality/selenium/core/visualization/VisualStateProvider.java @@ -2,7 +2,7 @@ import aquality.selenium.core.logging.ILogVisualState; import aquality.selenium.core.utilities.IElementActionRetrier; -import org.openqa.selenium.remote.RemoteWebElement; +import org.openqa.selenium.WebElement; import java.awt.*; import java.awt.image.BufferedImage; @@ -12,10 +12,10 @@ public class VisualStateProvider implements IVisualStateProvider { private final IImageComparator imageComparator; private final IElementActionRetrier actionRetrier; - private final Supplier getElement; + private final Supplier getElement; private final ILogVisualState stateLogger; - public VisualStateProvider(IImageComparator imageComparator, IElementActionRetrier actionRetrier, Supplier getElement, ILogVisualState stateLogger){ + public VisualStateProvider(IImageComparator imageComparator, IElementActionRetrier actionRetrier, Supplier getElement, ILogVisualState stateLogger){ this.imageComparator = imageComparator; this.actionRetrier = actionRetrier; this.getElement = getElement; @@ -70,7 +70,7 @@ public float getDifference(Image theOtherOne) { return value; } - private T getLoggedValue(String name, Function getValue, Function toString) { + private T getLoggedValue(String name, Function getValue, Function toString) { stateLogger.logVisualState("loc.el.visual.get" + name); T value = actionRetrier.doWithRetry(() -> getValue.apply(getElement.get())); String stringValue = toString == null ? getStringValue(value) : toString.apply(value); diff --git a/src/test/java/tests/applications/ICachedElement.java b/src/test/java/tests/applications/ICachedElement.java index 6aada0d..e47fd8e 100644 --- a/src/test/java/tests/applications/ICachedElement.java +++ b/src/test/java/tests/applications/ICachedElement.java @@ -6,12 +6,12 @@ import aquality.selenium.core.elements.interfaces.IElementCacheHandler; import aquality.selenium.core.elements.interfaces.IElementFinder; import aquality.selenium.core.elements.interfaces.IElementStateProvider; -import aquality.selenium.core.logging.ILogElementState; import aquality.selenium.core.localization.ILocalizationManager; import aquality.selenium.core.localization.ILocalizedLogger; +import aquality.selenium.core.logging.ILogElementState; import aquality.selenium.core.waitings.IConditionalWait; import org.openqa.selenium.By; -import org.openqa.selenium.remote.RemoteWebElement; +import org.openqa.selenium.WebElement; public interface ICachedElement { @@ -32,7 +32,7 @@ default IElementCacheHandler cache() { return getElementCacheHandler(); } - default RemoteWebElement getElement() { + default WebElement getElement() { return cache().getElement(); } diff --git a/src/test/java/tests/applications/browser/ChromeApplication.java b/src/test/java/tests/applications/browser/ChromeApplication.java index 3305a37..fdc2bb1 100644 --- a/src/test/java/tests/applications/browser/ChromeApplication.java +++ b/src/test/java/tests/applications/browser/ChromeApplication.java @@ -1,6 +1,7 @@ package tests.applications.browser; import aquality.selenium.core.applications.IApplication; +import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.RemoteWebDriver; @@ -17,7 +18,7 @@ public class ChromeApplication implements IApplication { } @Override - public RemoteWebDriver getDriver() { + public WebDriver getDriver() { return driver; } diff --git a/src/test/java/tests/applications/windowsApp/WindowsApplication.java b/src/test/java/tests/applications/windowsApp/WindowsApplication.java index a3d9321..d16f4b7 100644 --- a/src/test/java/tests/applications/windowsApp/WindowsApplication.java +++ b/src/test/java/tests/applications/windowsApp/WindowsApplication.java @@ -3,7 +3,7 @@ import aquality.selenium.core.applications.IApplication; import io.appium.java_client.windows.WindowsDriver; import io.appium.java_client.windows.options.WindowsOptions; -import org.openqa.selenium.remote.RemoteWebDriver; +import org.openqa.selenium.WebDriver; import java.net.URL; import java.time.Duration; @@ -20,7 +20,7 @@ public class WindowsApplication implements IApplication { } @Override - public RemoteWebDriver getDriver() { + public WebDriver getDriver() { return driver; } diff --git a/src/test/java/tests/elements/CachedWebElementTests.java b/src/test/java/tests/elements/CachedWebElementTests.java index a190442..49b026a 100644 --- a/src/test/java/tests/elements/CachedWebElementTests.java +++ b/src/test/java/tests/elements/CachedWebElementTests.java @@ -2,6 +2,7 @@ import aquality.selenium.core.elements.interfaces.IElementStateProvider; import aquality.selenium.core.waitings.IConditionalWait; +import org.openqa.selenium.remote.RemoteWebElement; import org.testng.Assert; import org.testng.annotations.Test; import tests.applications.browser.AqualityServices; @@ -61,17 +62,17 @@ public void testShouldBeStaleWhenBecameInvisible() { Assert.assertFalse(loader.state().isExist(), "Loader that was displayed previously and become invisible should be treated as disappeared"); Assert.assertTrue(loader.state().waitForExist(ZERO_TIMEOUT), - "When waiting for existance, we should get an actual element's state"); + "When waiting for existence, we should get an actual element's state"); } @Test public void testShouldRefreshElementWhenItIsStale() { openDynamicControls(); CachedLabel example = DynamicControlsForm.getContentCachedLabel(); - String exampleToString = example.getElement().getId(); + String exampleToString = ((RemoteWebElement)example.getElement()).getId(); getBrowser().getDriver().navigate().refresh(); Assert.assertTrue(example.cache().isRefreshNeeded(), "refresh should be needed when refreshed the page"); - String newToString = example.getElement().getId(); + String newToString = ((RemoteWebElement)example.getElement()).getId(); Assert.assertNotEquals(newToString, exampleToString, "new and old element's IDs should be different"); } @@ -80,7 +81,7 @@ public void testShouldReturnCorrectStateFalseWhenWindowIsRefreshed(Predicate stateCondition) throws TimeoutException { assertStateConditionAfterRefresh(stateCondition, true); } diff --git a/src/test/java/tests/elements/CachedWindowsElementTests.java b/src/test/java/tests/elements/CachedWindowsElementTests.java index 693728a..05b7de4 100644 --- a/src/test/java/tests/elements/CachedWindowsElementTests.java +++ b/src/test/java/tests/elements/CachedWindowsElementTests.java @@ -2,6 +2,7 @@ import aquality.selenium.core.applications.IApplication; import aquality.selenium.core.elements.interfaces.IElementStateProvider; +import io.appium.java_client.remote.AppiumWebElement; import org.testng.Assert; import org.testng.annotations.Test; import tests.ITestWithApplication; @@ -36,28 +37,28 @@ public void testShouldWorkWithCalculatorWithCachedElement() { @Test public void testShouldReturnSameElementAfterInteraction() { CachedButton oneButton = new CachedButton(CalculatorWindow.getOneButtonLoc()); - String initialElement = oneButton.getElement().getId(); + String initialElement = ((AppiumWebElement)oneButton.getElement()).getId(); oneButton.click(); - String resultElement = oneButton.getElement().getId(); + String resultElement = ((AppiumWebElement)oneButton.getElement()).getId(); Assert.assertEquals(resultElement, initialElement, "Element should be the same after getting interaction"); } @Test public void testShouldReturnSameElementAfterGetState() { CachedButton oneButton = new CachedButton(CalculatorWindow.getOneButtonLoc()); - String initialElement = oneButton.getElement().getId(); + String initialElement = ((AppiumWebElement)oneButton.getElement()).getId(); oneButton.state().waitForClickable(); - String resultElement = oneButton.getElement().getId(); + String resultElement = ((AppiumWebElement)oneButton.getElement()).getId(); Assert.assertEquals(resultElement, initialElement, "Element should be the same after getting state"); } @Test public void testShouldReturnNewElementWhenWindowIsReopened() { CachedButton oneButton = new CachedButton(CalculatorWindow.getOneButtonLoc()); - String initialElement = oneButton.getElement().getId(); + String initialElement = ((AppiumWebElement)oneButton.getElement()).getId(); getApplication().getDriver().quit(); oneButton.state().waitForClickable(); - String resultElement = oneButton.getElement().getId(); + String resultElement = ((AppiumWebElement)oneButton.getElement()).getId(); Assert.assertNotEquals(resultElement, initialElement, "Element is still the same after reopening the window"); } @@ -66,7 +67,7 @@ public void testShouldReturnCorrectStateWhenWindowIsClosed(Predicate stateCondition) { assertStateConditionAfterQuit(stateCondition, true, true); } @@ -78,6 +79,6 @@ private void assertStateConditionAfterQuit(Predicate stat Assert.assertEquals(stateCondition.test(oneButton.state()), expectedValue, "Element state condition is not expected after closing the window"); Assert.assertEquals(isApplicationStarted(), shouldAppRestart, - String.format("Window was %1$s reopened when retrived the element state.", shouldAppRestart ? "not" : "")); + String.format("Window was %1$s reopened when retrieved the element state.", shouldAppRestart ? "not" : "")); } } diff --git a/src/test/java/tests/elements/ICachedElementTests.java b/src/test/java/tests/elements/ICachedElementTests.java index 07349a6..9628978 100644 --- a/src/test/java/tests/elements/ICachedElementTests.java +++ b/src/test/java/tests/elements/ICachedElementTests.java @@ -22,7 +22,7 @@ default Object[] stateFunctionsFalseWhenElementStale() { } @DataProvider - default Object[] stateFunctionsTrueWhenElementStaleWhichRetriveElement() { + default Object[] stateFunctionsTrueWhenElementStaleWhichRetrieveElement() { List> stateFunctions = new ArrayList<>(); stateFunctions.add(IElementStateProvider::isEnabled); stateFunctions.add(IElementStateProvider::isClickable); diff --git a/src/test/java/tests/elements/WebElementTests.java b/src/test/java/tests/elements/WebElementTests.java index 59c94c9..336d9f0 100644 --- a/src/test/java/tests/elements/WebElementTests.java +++ b/src/test/java/tests/elements/WebElementTests.java @@ -3,7 +3,7 @@ import aquality.selenium.core.applications.IApplication; import aquality.selenium.core.elements.ElementState; import org.openqa.selenium.By; -import org.openqa.selenium.remote.RemoteWebElement; +import org.openqa.selenium.WebElement; import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -54,15 +54,15 @@ public void testShouldBePossibleToGetState() { @Test public void testShouldBePossibleToGetElement() { getApplication().getDriver().navigate().to(TheInternetPage.DYNAMIC_CONTROLS.getAddress()); - RemoteWebElement element = DynamicControlsForm.getEnableButton().getElement(); - Assert.assertNotNull(element, "RemoteWebElement should not be null"); + WebElement element = DynamicControlsForm.getEnableButton().getElement(); + Assert.assertNotNull(element, "WebElement should not be null"); } @Test public void testShouldBePossibleToGetElementWithCustomTimeout() { getApplication().getDriver().navigate().to(TheInternetPage.DYNAMIC_CONTROLS.getAddress()); - RemoteWebElement element = DynamicControlsForm.getEnableButton().getElement(Duration.ofSeconds(1L)); - Assert.assertNotNull(element, "RemoteWebElement should not be null"); + WebElement element = DynamicControlsForm.getEnableButton().getElement(Duration.ofSeconds(1L)); + Assert.assertNotNull(element, "WebElement should not be null"); } @Test diff --git a/src/test/java/tests/elements/WindowsElementTests.java b/src/test/java/tests/elements/WindowsElementTests.java index 4497397..d3c04c1 100644 --- a/src/test/java/tests/elements/WindowsElementTests.java +++ b/src/test/java/tests/elements/WindowsElementTests.java @@ -3,7 +3,7 @@ import aquality.selenium.core.applications.IApplication; import aquality.selenium.core.elements.ElementState; import org.openqa.selenium.By; -import org.openqa.selenium.remote.RemoteWebElement; +import org.openqa.selenium.WebElement; import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -51,14 +51,14 @@ public void testShouldBePossibleToGetState() { @Test public void testShouldBePossibleToGetElement() { - RemoteWebElement element = CalculatorWindow.getOneButton().getElement(); - Assert.assertNotNull(element, "RemoteWebElement should not be null"); + WebElement element = CalculatorWindow.getOneButton().getElement(); + Assert.assertNotNull(element, "WebElement should not be null"); } @Test public void testShouldBePossibleToGetElementWithCustomTimeout() { - RemoteWebElement element = CalculatorWindow.getOneButton().getElement(Duration.ofSeconds(1L)); - Assert.assertNotNull(element, "RemoteWebElement should not be null"); + WebElement element = CalculatorWindow.getOneButton().getElement(Duration.ofSeconds(1L)); + Assert.assertNotNull(element, "WebElement should not be null"); } @Test