From fe869363ceff0bdab08ca53884c62f41fd74af78 Mon Sep 17 00:00:00 2001 From: Mustafa Agamy Date: Mon, 20 Jan 2025 20:03:50 +0000 Subject: [PATCH 1/4] Add Formatting with Locale.ROOT for the port at : - ChromeDriverService - EdgeDriverService - GeckoDriverService - InternetExplorerDriverService and to the getUrl method at: - DriverService Refactor the Arabic Tests in the following accordingly: - ChromeDriverFunctionalTest - EdgeDriverFunctionalTest - FirefoxDriverTest - InternetExplorerDriverTest - SafariDriverTest --- .../openqa/selenium/chrome/ChromeDriverService.java | 2 +- .../org/openqa/selenium/edge/EdgeDriverService.java | 2 +- .../openqa/selenium/firefox/GeckoDriverService.java | 3 ++- .../selenium/ie/InternetExplorerDriverService.java | 3 ++- .../selenium/remote/service/DriverService.java | 13 +------------ .../selenium/chrome/ChromeDriverFunctionalTest.java | 12 ++---------- .../selenium/edge/EdgeDriverFunctionalTest.java | 12 ++---------- .../openqa/selenium/firefox/FirefoxDriverTest.java | 12 ++---------- .../selenium/ie/InternetExplorerDriverTest.java | 12 ++---------- .../openqa/selenium/safari/SafariDriverTest.java | 12 ++---------- 10 files changed, 17 insertions(+), 66 deletions(-) diff --git a/java/src/org/openqa/selenium/chrome/ChromeDriverService.java b/java/src/org/openqa/selenium/chrome/ChromeDriverService.java index d6beaa0b69489..3b1d61446df8f 100644 --- a/java/src/org/openqa/selenium/chrome/ChromeDriverService.java +++ b/java/src/org/openqa/selenium/chrome/ChromeDriverService.java @@ -284,7 +284,7 @@ protected void loadSystemProperties() { @Override protected List createArgs() { List args = new ArrayList<>(); - args.add(String.format("--port=%d", getPort())); + args.add(String.format(Locale.ROOT, "--port=%d", getPort())); // Readable timestamp and append logs only work if log path is specified in args // Cannot use logOutput because goog:loggingPrefs requires --log-path get sent diff --git a/java/src/org/openqa/selenium/edge/EdgeDriverService.java b/java/src/org/openqa/selenium/edge/EdgeDriverService.java index 0e3c252087882..799e3c3759d95 100644 --- a/java/src/org/openqa/selenium/edge/EdgeDriverService.java +++ b/java/src/org/openqa/selenium/edge/EdgeDriverService.java @@ -278,7 +278,7 @@ protected void loadSystemProperties() { @Override protected List createArgs() { List args = new ArrayList<>(); - args.add(String.format("--port=%d", getPort())); + args.add(String.format(Locale.ROOT, "--port=%d", getPort())); // Readable timestamp and append logs only work if log path is specified in args // Cannot use logOutput because goog:loggingPrefs requires --log-path get sent diff --git a/java/src/org/openqa/selenium/firefox/GeckoDriverService.java b/java/src/org/openqa/selenium/firefox/GeckoDriverService.java index c2a73827046b8..7602085d506f6 100644 --- a/java/src/org/openqa/selenium/firefox/GeckoDriverService.java +++ b/java/src/org/openqa/selenium/firefox/GeckoDriverService.java @@ -30,6 +30,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import org.openqa.selenium.Capabilities; import org.openqa.selenium.WebDriverException; @@ -219,7 +220,7 @@ protected void loadSystemProperties() { @Override protected List createArgs() { List args = new ArrayList<>(); - args.add(String.format("--port=%d", getPort())); + args.add(String.format(Locale.ROOT, "--port=%d", getPort())); int wsPort = PortProber.findFreePort(); args.add(String.format("--websocket-port=%d", wsPort)); diff --git a/java/src/org/openqa/selenium/ie/InternetExplorerDriverService.java b/java/src/org/openqa/selenium/ie/InternetExplorerDriverService.java index 506da630d991a..e66f0eab35a81 100644 --- a/java/src/org/openqa/selenium/ie/InternetExplorerDriverService.java +++ b/java/src/org/openqa/selenium/ie/InternetExplorerDriverService.java @@ -28,6 +28,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import org.openqa.selenium.Capabilities; import org.openqa.selenium.WebDriverException; @@ -217,7 +218,7 @@ protected void loadSystemProperties() { @Override protected List createArgs() { List args = new ArrayList<>(); - args.add(String.format("--port=%d", getPort())); + args.add(String.format(Locale.ROOT, "--port=%d", getPort())); if (logLevel != null) { args.add(String.format("--log-level=%s", logLevel)); diff --git a/java/src/org/openqa/selenium/remote/service/DriverService.java b/java/src/org/openqa/selenium/remote/service/DriverService.java index b0cb2bac5c39f..5fea8bb60081e 100644 --- a/java/src/org/openqa/selenium/remote/service/DriverService.java +++ b/java/src/org/openqa/selenium/remote/service/DriverService.java @@ -138,7 +138,7 @@ protected Map getEnvironment() { } protected URL getUrl(int port) throws IOException { - return new URL(String.format("http://localhost:%d", port)); + return new URL(String.format(Locale.ROOT,"http://localhost:%d", port)); } protected Capabilities getDefaultDriverOptions() { @@ -505,17 +505,6 @@ public DS build() { port = PortProber.findFreePort(); } - if (Locale.getDefault(Locale.Category.FORMAT).getLanguage().equals("ar")) { - throw new NumberFormatException( - String.format( - "Couldn't format the port numbers because the System Language is arabic: \"" - + String.format("--port=%d", port) - + "\", please make sure to add the required arguments \"-Duser.language=en" - + " -Duser.region=US\" to your JVM, for more info please visit :\n" - + " https://www.selenium.dev/documentation/webdriver/browsers/", - getPort())); - } - if (timeout == null) { timeout = getDefaultTimeout(); } diff --git a/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java b/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java index 6be2366ebf372..4a7154c9363e6 100644 --- a/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java +++ b/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java @@ -204,22 +204,14 @@ void canExecuteCdpCommands() { @Test @NoDriverBeforeTest - void shouldThrowNumberFormatException() { + void shouldLaunchSuccessfullyWithArabicDate() { Locale arabicLocale = new Locale("ar", "EG"); Locale.setDefault(arabicLocale); int port = PortProber.findFreePort(); ChromeDriverService.Builder builder = new ChromeDriverService.Builder(); builder.usingPort(port); - - assertThatExceptionOfType(NumberFormatException.class) - .isThrownBy(builder::build) - .withMessage( - "Couldn't format the port numbers because the System Language is arabic: \"" - + String.format("--port=%d", port) - + "\", please make sure to add the required arguments \"-Duser.language=en" - + " -Duser.region=US\" to your JVM, for more info please visit :\n" - + " https://www.selenium.dev/documentation/webdriver/browsers/"); + builder.build(); Locale.setDefault(Locale.US); } diff --git a/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java b/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java index a2fa5a38d0539..624a6c018ecd5 100644 --- a/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java +++ b/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java @@ -198,22 +198,14 @@ void canExecuteCdpCommands() { @Test @NoDriverBeforeTest - void shouldThrowNumberFormatException() { + void shouldLaunchSuccessfullyWithArabicDate() { Locale arabicLocale = new Locale("ar", "EG"); Locale.setDefault(arabicLocale); int port = PortProber.findFreePort(); EdgeDriverService.Builder builder = new EdgeDriverService.Builder(); builder.usingPort(port); - - assertThatExceptionOfType(NumberFormatException.class) - .isThrownBy(builder::build) - .withMessage( - "Couldn't format the port numbers because the System Language is arabic: \"" - + String.format("--port=%d", port) - + "\", please make sure to add the required arguments \"-Duser.language=en" - + " -Duser.region=US\" to your JVM, for more info please visit :\n" - + " https://www.selenium.dev/documentation/webdriver/browsers/"); + builder.build(); Locale.setDefault(Locale.US); } diff --git a/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java b/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java index 85e0a7fe1c398..f5d094cdc367d 100644 --- a/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java +++ b/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java @@ -273,22 +273,14 @@ void canSetContext() { @Test @NoDriverBeforeTest - void shouldThrowNumberFormatException() { + void shouldLaunchSuccessfullyWithArabicDate() { Locale arabicLocale = new Locale("ar", "EG"); Locale.setDefault(arabicLocale); int port = PortProber.findFreePort(); GeckoDriverService.Builder builder = new GeckoDriverService.Builder(); builder.usingPort(port); - - assertThatExceptionOfType(NumberFormatException.class) - .isThrownBy(builder::build) - .withMessage( - "Couldn't format the port numbers because the System Language is arabic: \"" - + String.format("--port=%d", port) - + "\", please make sure to add the required arguments \"-Duser.language=en" - + " -Duser.region=US\" to your JVM, for more info please visit :\n" - + " https://www.selenium.dev/documentation/webdriver/browsers/"); + builder.build(); Locale.setDefault(Locale.US); } diff --git a/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java b/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java index c93e1361195cf..80c3caa9f19a0 100644 --- a/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java +++ b/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java @@ -147,22 +147,14 @@ void testPersistentHoverCanBeTurnedOff() throws Exception { @Test @NoDriverBeforeTest - void shouldThrowNumberFormatException() { + void shouldLaunchSuccessfullyWithArabicDate() { Locale arabicLocale = new Locale("ar", "EG"); Locale.setDefault(arabicLocale); int port = PortProber.findFreePort(); InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder(); builder.usingPort(port); - - assertThatExceptionOfType(NumberFormatException.class) - .isThrownBy(builder::build) - .withMessage( - "Couldn't format the port numbers because the System Language is arabic: \"" - + String.format("--port=%d", port) - + "\", please make sure to add the required arguments \"-Duser.language=en" - + " -Duser.region=US\" to your JVM, for more info please visit :\n" - + " https://www.selenium.dev/documentation/webdriver/browsers/"); + builder.build(); Locale.setDefault(Locale.US); } diff --git a/java/test/org/openqa/selenium/safari/SafariDriverTest.java b/java/test/org/openqa/selenium/safari/SafariDriverTest.java index 6312c0ad1e211..92f53acbb27e9 100644 --- a/java/test/org/openqa/selenium/safari/SafariDriverTest.java +++ b/java/test/org/openqa/selenium/safari/SafariDriverTest.java @@ -137,22 +137,14 @@ public void canAttachDebugger() { @Test @NoDriverBeforeTest - void shouldThrowNumberFormatException() { + void shouldLaunchSuccessfullyWithArabicDate() { Locale arabicLocale = new Locale("ar", "EG"); Locale.setDefault(arabicLocale); int port = PortProber.findFreePort(); SafariDriverService.Builder builder = new SafariDriverService.Builder(); builder.usingPort(port); - - assertThatExceptionOfType(NumberFormatException.class) - .isThrownBy(builder::build) - .withMessage( - "Couldn't format the port numbers because the System Language is arabic: \"" - + String.format("--port=%d", port) - + "\", please make sure to add the required arguments \"-Duser.language=en" - + " -Duser.region=US\" to your JVM, for more info please visit :\n" - + " https://www.selenium.dev/documentation/webdriver/browsers/"); + builder.build(); Locale.setDefault(Locale.US); } From 6685d7b1ab6b686303ed809e9e6d64eb74f2069b Mon Sep 17 00:00:00 2001 From: Mustafa Agamy Date: Mon, 20 Jan 2025 21:58:42 +0000 Subject: [PATCH 2/4] add try and catch with finally to handle switching the locale default --- .idea/kotlinc.xml | 7 ------ .idea/misc.xml | 3 ++- .../chrome/ChromeDriverFunctionalTest.java | 19 +++++++++------ .../edge/EdgeDriverFunctionalTest.java | 19 +++++++++------ .../selenium/firefox/FirefoxDriverTest.java | 20 +++++++++------- .../ie/InternetExplorerDriverTest.java | 19 +++++++++------ .../selenium/safari/SafariDriverTest.java | 23 +++++++++++-------- 7 files changed, 64 insertions(+), 46 deletions(-) delete mode 100644 .idea/kotlinc.xml diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index 1c24f9a8de49b..0000000000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index c052579f90a0f..184080924215a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,9 +1,10 @@ + - + \ No newline at end of file diff --git a/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java b/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java index 4a7154c9363e6..071ca9459e7cd 100644 --- a/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java +++ b/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java @@ -205,14 +205,19 @@ void canExecuteCdpCommands() { @Test @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); + try { + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); - int port = PortProber.findFreePort(); - ChromeDriverService.Builder builder = new ChromeDriverService.Builder(); - builder.usingPort(port); - builder.build(); + int port = PortProber.findFreePort(); + ChromeDriverService.Builder builder = new ChromeDriverService.Builder(); + builder.usingPort(port); + builder.build(); - Locale.setDefault(Locale.US); + } catch (Exception e) { + throw e; + } finally { + Locale.setDefault(Locale.US); + } } } diff --git a/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java b/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java index 624a6c018ecd5..35c589df2199f 100644 --- a/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java +++ b/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java @@ -199,14 +199,19 @@ void canExecuteCdpCommands() { @Test @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); + try { + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); - int port = PortProber.findFreePort(); - EdgeDriverService.Builder builder = new EdgeDriverService.Builder(); - builder.usingPort(port); - builder.build(); + int port = PortProber.findFreePort(); + EdgeDriverService.Builder builder = new EdgeDriverService.Builder(); + builder.usingPort(port); + builder.build(); - Locale.setDefault(Locale.US); + } catch (Exception e) { + throw e; + } finally { + Locale.setDefault(Locale.US); + } } } diff --git a/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java b/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java index f5d094cdc367d..5b3e3e1554393 100644 --- a/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java +++ b/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java @@ -18,7 +18,6 @@ package org.openqa.selenium.firefox; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType; import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -274,15 +273,20 @@ void canSetContext() { @Test @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); + try { + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); - int port = PortProber.findFreePort(); - GeckoDriverService.Builder builder = new GeckoDriverService.Builder(); - builder.usingPort(port); - builder.build(); + int port = PortProber.findFreePort(); + GeckoDriverService.Builder builder = new GeckoDriverService.Builder(); + builder.usingPort(port); + builder.build(); - Locale.setDefault(Locale.US); + } catch (Exception e) { + throw e; + } finally { + Locale.setDefault(Locale.US); + } } private static class CustomFirefoxProfile extends FirefoxProfile {} diff --git a/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java b/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java index 80c3caa9f19a0..5a7f35e66999e 100644 --- a/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java +++ b/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java @@ -148,15 +148,20 @@ void testPersistentHoverCanBeTurnedOff() throws Exception { @Test @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); + try { + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); - int port = PortProber.findFreePort(); - InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder(); - builder.usingPort(port); - builder.build(); + int port = PortProber.findFreePort(); + InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder(); + builder.usingPort(port); + builder.build(); - Locale.setDefault(Locale.US); + } catch (Exception e) { + throw e; + } finally { + Locale.setDefault(Locale.US); + } } private WebDriver newIeDriver() { diff --git a/java/test/org/openqa/selenium/safari/SafariDriverTest.java b/java/test/org/openqa/selenium/safari/SafariDriverTest.java index 92f53acbb27e9..f2769d4234785 100644 --- a/java/test/org/openqa/selenium/safari/SafariDriverTest.java +++ b/java/test/org/openqa/selenium/safari/SafariDriverTest.java @@ -138,14 +138,19 @@ public void canAttachDebugger() { @Test @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); - - int port = PortProber.findFreePort(); - SafariDriverService.Builder builder = new SafariDriverService.Builder(); - builder.usingPort(port); - builder.build(); - - Locale.setDefault(Locale.US); + try { + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); + + int port = PortProber.findFreePort(); + SafariDriverService.Builder builder = new SafariDriverService.Builder(); + builder.usingPort(port); + builder.build(); + + } catch (Exception e) { + throw e; + } finally { + Locale.setDefault(Locale.US); + } } } From 7169a27cf55600be1685bb5f256be1f0f9f8d2b4 Mon Sep 17 00:00:00 2001 From: Mustafa Agamy Date: Mon, 20 Jan 2025 22:02:53 +0000 Subject: [PATCH 3/4] reverse --- .idea/kotlinc.xml | 7 +++++++ .idea/misc.xml | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .idea/kotlinc.xml diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000000000..1c24f9a8de49b --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 184080924215a..c052579f90a0f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,10 +1,9 @@ - - + \ No newline at end of file From 6072c953876e3cf11908c2e7a667e0c93727c62a Mon Sep 17 00:00:00 2001 From: Puja Jagani Date: Tue, 21 Jan 2025 10:29:33 +0530 Subject: [PATCH 4/4] Fix formatting --- .../selenium/remote/service/DriverService.java | 2 +- .../chrome/ChromeDriverFunctionalTest.java | 16 ++++++++-------- .../selenium/edge/EdgeDriverFunctionalTest.java | 16 ++++++++-------- .../selenium/firefox/FirefoxDriverTest.java | 16 ++++++++-------- .../selenium/ie/InternetExplorerDriverTest.java | 16 ++++++++-------- .../openqa/selenium/safari/SafariDriverTest.java | 16 ++++++++-------- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/java/src/org/openqa/selenium/remote/service/DriverService.java b/java/src/org/openqa/selenium/remote/service/DriverService.java index 5fea8bb60081e..d957b694fb004 100644 --- a/java/src/org/openqa/selenium/remote/service/DriverService.java +++ b/java/src/org/openqa/selenium/remote/service/DriverService.java @@ -138,7 +138,7 @@ protected Map getEnvironment() { } protected URL getUrl(int port) throws IOException { - return new URL(String.format(Locale.ROOT,"http://localhost:%d", port)); + return new URL(String.format(Locale.ROOT, "http://localhost:%d", port)); } protected Capabilities getDefaultDriverOptions() { diff --git a/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java b/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java index 071ca9459e7cd..ce0d823408d00 100644 --- a/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java +++ b/java/test/org/openqa/selenium/chrome/ChromeDriverFunctionalTest.java @@ -206,18 +206,18 @@ void canExecuteCdpCommands() { @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { try { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); - int port = PortProber.findFreePort(); - ChromeDriverService.Builder builder = new ChromeDriverService.Builder(); - builder.usingPort(port); - builder.build(); + int port = PortProber.findFreePort(); + ChromeDriverService.Builder builder = new ChromeDriverService.Builder(); + builder.usingPort(port); + builder.build(); } catch (Exception e) { - throw e; + throw e; } finally { - Locale.setDefault(Locale.US); + Locale.setDefault(Locale.US); } } } diff --git a/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java b/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java index 35c589df2199f..82fab3ccf1602 100644 --- a/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java +++ b/java/test/org/openqa/selenium/edge/EdgeDriverFunctionalTest.java @@ -200,18 +200,18 @@ void canExecuteCdpCommands() { @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { try { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); - int port = PortProber.findFreePort(); - EdgeDriverService.Builder builder = new EdgeDriverService.Builder(); - builder.usingPort(port); - builder.build(); + int port = PortProber.findFreePort(); + EdgeDriverService.Builder builder = new EdgeDriverService.Builder(); + builder.usingPort(port); + builder.build(); } catch (Exception e) { - throw e; + throw e; } finally { - Locale.setDefault(Locale.US); + Locale.setDefault(Locale.US); } } } diff --git a/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java b/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java index 5b3e3e1554393..bfc92e800f6a8 100644 --- a/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java +++ b/java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java @@ -274,18 +274,18 @@ void canSetContext() { @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { try { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); - int port = PortProber.findFreePort(); - GeckoDriverService.Builder builder = new GeckoDriverService.Builder(); - builder.usingPort(port); - builder.build(); + int port = PortProber.findFreePort(); + GeckoDriverService.Builder builder = new GeckoDriverService.Builder(); + builder.usingPort(port); + builder.build(); } catch (Exception e) { - throw e; + throw e; } finally { - Locale.setDefault(Locale.US); + Locale.setDefault(Locale.US); } } diff --git a/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java b/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java index 5a7f35e66999e..70ade3fbe332f 100644 --- a/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java +++ b/java/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java @@ -149,18 +149,18 @@ void testPersistentHoverCanBeTurnedOff() throws Exception { @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { try { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); - int port = PortProber.findFreePort(); - InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder(); - builder.usingPort(port); - builder.build(); + int port = PortProber.findFreePort(); + InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder(); + builder.usingPort(port); + builder.build(); } catch (Exception e) { - throw e; + throw e; } finally { - Locale.setDefault(Locale.US); + Locale.setDefault(Locale.US); } } diff --git a/java/test/org/openqa/selenium/safari/SafariDriverTest.java b/java/test/org/openqa/selenium/safari/SafariDriverTest.java index f2769d4234785..15118a013a6d1 100644 --- a/java/test/org/openqa/selenium/safari/SafariDriverTest.java +++ b/java/test/org/openqa/selenium/safari/SafariDriverTest.java @@ -139,18 +139,18 @@ public void canAttachDebugger() { @NoDriverBeforeTest void shouldLaunchSuccessfullyWithArabicDate() { try { - Locale arabicLocale = new Locale("ar", "EG"); - Locale.setDefault(arabicLocale); + Locale arabicLocale = new Locale("ar", "EG"); + Locale.setDefault(arabicLocale); - int port = PortProber.findFreePort(); - SafariDriverService.Builder builder = new SafariDriverService.Builder(); - builder.usingPort(port); - builder.build(); + int port = PortProber.findFreePort(); + SafariDriverService.Builder builder = new SafariDriverService.Builder(); + builder.usingPort(port); + builder.build(); } catch (Exception e) { - throw e; + throw e; } finally { - Locale.setDefault(Locale.US); + Locale.setDefault(Locale.US); } } }