Skip to content

Commit 563d81b

Browse files
authored
Merge branch 'trunk' into add_javadoc_support_event_classes
2 parents 803265b + c806757 commit 563d81b

File tree

13 files changed

+74
-23
lines changed

13 files changed

+74
-23
lines changed

.github/workflows/bazel.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
java-version: ${{ inputs.java-version }}
8282
distribution: 'temurin'
8383
- name: Setup Bazel
84-
uses: p0deje/setup-bazel@0.2.0
84+
uses: p0deje/setup-bazel@0.3.2
8585
with:
8686
bazelisk-cache: true
8787
disk-cache: ${{ inputs.cache-key }}

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
fetch-depth: 50
2727
- name: Setup Bazel
28-
uses: p0deje/setup-bazel@0.2.0
28+
uses: p0deje/setup-bazel@0.3.2
2929
with:
3030
bazelisk-cache: true
3131
external-cache: |

.github/workflows/should-workflow-run.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with:
3030
fetch-depth: 50
3131
- name: Setup Bazel
32-
uses: p0deje/setup-bazel@0.2.0
32+
uses: p0deje/setup-bazel@0.3.2
3333
with:
3434
bazelisk-cache: true
3535
external-cache: |

WORKSPACE

+3-3
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,9 @@ pin_browsers()
327327

328328
http_archive(
329329
name = "rules_ruby",
330-
sha256 = "34296f8cad46ec10b7eea59f3399feabcfbc33935b7d8bec880ea0ecfadc23b5",
331-
strip_prefix = "rules_ruby-9550503e1c1702375e87837d43eb137030edd28a",
332-
url = "https://github.com/p0deje/rules_ruby/archive/9550503e1c1702375e87837d43eb137030edd28a.zip",
330+
sha256 = "92055f29f94963cd3cf7be1da15503c3306879e2e8545b2b5f9e5bb37d6713d3",
331+
strip_prefix = "rules_ruby-0.2.0",
332+
url = "https://github.com/p0deje/rules_ruby/releases/download/v0.2.0/rules_ruby-v0.2.0.tar.gz",
333333
)
334334

335335
load(

java/src/org/openqa/selenium/Platform.java

+12
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,18 @@ public String toString() {
289289
}
290290
},
291291

292+
SONOMA("sonoma", "os x 14.0", "macos 14.0") {
293+
@Override
294+
public Platform family() {
295+
return MAC;
296+
}
297+
298+
@Override
299+
public String toString() {
300+
return "macOS 14.0";
301+
}
302+
},
303+
292304
/** Many platforms have UNIX traits, amongst them LINUX, Solaris and BSD. */
293305
UNIX("solaris", "bsd") {
294306
@Override

java/src/org/openqa/selenium/manager/SeleniumManager.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
// under the License.
1717
package org.openqa.selenium.manager;
1818

19+
import static org.openqa.selenium.Platform.LINUX;
1920
import static org.openqa.selenium.Platform.MAC;
21+
import static org.openqa.selenium.Platform.UNIX;
2022
import static org.openqa.selenium.Platform.WINDOWS;
2123

2224
import java.io.IOException;
@@ -171,13 +173,23 @@ private synchronized Path getBinary() {
171173
if (binary == null) {
172174
try {
173175
Platform current = Platform.getCurrent();
174-
String folder = "linux";
176+
String folder = "";
175177
String extension = "";
176178
if (current.is(WINDOWS)) {
177179
extension = EXE;
178180
folder = "windows";
179181
} else if (current.is(MAC)) {
180182
folder = "macos";
183+
} else if (current.is(LINUX)) {
184+
folder = "linux";
185+
} else if (current.is(UNIX)) {
186+
LOG.warning(
187+
String.format(
188+
"Selenium Manager binary may not be compatible with %s; verify settings",
189+
current));
190+
folder = "linux";
191+
} else {
192+
throw new WebDriverException("Unsupported platform: " + current);
181193
}
182194

183195
binary = getBinaryInCache(SELENIUM_MANAGER + extension);

py/selenium/webdriver/common/bidi/cdp.py

+5
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,11 @@ async def _reader_task(self):
453453
else:
454454
self._handle_data(data)
455455

456+
for _, session in self.sessions.items():
457+
for _, senders in session.channels.items():
458+
for sender in senders:
459+
sender.close()
460+
456461

457462
@asynccontextmanager
458463
async def open_cdp(url) -> typing.AsyncIterator[CdpConnection]:

py/selenium/webdriver/common/selenium_manager.py

+19-10
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,32 @@ def get_binary() -> Path:
3939
"""Determines the path of the correct Selenium Manager binary.
4040
4141
:Returns: The Selenium Manager executable location
42+
43+
:Raises: WebDriverException if the platform is unsupported
4244
"""
4345

4446
if (path := os.getenv("SE_MANAGER_PATH")) is not None:
4547
return Path(path)
46-
else:
47-
platform = sys.platform
4848

49-
dirs = {
50-
"darwin": "macos",
51-
"win32": "windows",
52-
"cygwin": "windows",
53-
}
49+
dirs = {
50+
"darwin": "macos",
51+
"win32": "windows",
52+
"cygwin": "windows",
53+
"linux": "linux",
54+
"freebsd": "linux",
55+
"openbsd": "linux",
56+
}
57+
58+
directory = dirs.get(sys.platform)
59+
if directory is None:
60+
raise WebDriverException(f"Unsupported platform: {sys.platform}")
61+
62+
if sys.platform in ["freebsd", "openbsd"]:
63+
logger.warning("Selenium Manager binary may not be compatible with %s; verify settings", sys.platform)
5464

55-
directory = dirs.get(platform) if dirs.get(platform) else platform
56-
file = "selenium-manager.exe" if directory == "windows" else "selenium-manager"
65+
file = "selenium-manager.exe" if directory == "windows" else "selenium-manager"
5766

58-
path = Path(__file__).parent.joinpath(directory, file)
67+
path = Path(__file__).parent.joinpath(directory, file)
5968

6069
if not path.is_file():
6170
raise WebDriverException(f"Unable to obtain working Selenium Manager binary; {path}")

py/selenium/webdriver/remote/webelement.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from base64 import encodebytes
2626
from hashlib import md5 as md5_hash
2727
from io import BytesIO
28+
from typing import List
2829

2930
from selenium.common.exceptions import JavascriptException
3031
from selenium.common.exceptions import WebDriverException
@@ -415,7 +416,7 @@ def find_element(self, by=By.ID, value=None) -> WebElement:
415416

416417
return self._execute(Command.FIND_CHILD_ELEMENT, {"using": by, "value": value})["value"]
417418

418-
def find_elements(self, by=By.ID, value=None) -> list[WebElement]:
419+
def find_elements(self, by=By.ID, value=None) -> List[WebElement]:
419420
"""Find elements given a By strategy and locator.
420421
421422
:Usage:

rb/lib/selenium/webdriver/common/platform.rb

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ def linux?
8686
os == :linux
8787
end
8888

89+
def unix?
90+
os == :unix
91+
end
92+
8993
def wsl?
9094
return false unless linux?
9195

rb/lib/selenium/webdriver/common/selenium_manager.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def driver_path(options)
4141

4242
output = run(*command)
4343

44-
browser_path = output['browser_path']
45-
driver_path = output['driver_path']
44+
browser_path = Platform.cygwin? ? Platform.cygwin_path(output['browser_path']) : output['browser_path']
45+
driver_path = Platform.cygwin? ? Platform.cygwin_path(output['driver_path']) : output['driver_path']
4646
Platform.assert_executable driver_path
4747

4848
if options.respond_to?(:binary) && browser_path && !browser_path.empty?
@@ -83,7 +83,13 @@ def binary
8383
"#{directory}/macos/selenium-manager"
8484
elsif Platform.linux?
8585
"#{directory}/linux/selenium-manager"
86+
elsif Platform.unix?
87+
WebDriver.logger.warn('Selenium Manager binary may not be compatible with Unix; verify settings',
88+
id: %i[selenium_manager unix_binary])
89+
"#{directory}/linux/selenium-manager"
8690
end
91+
rescue Error::WebDriverError => e
92+
raise Error::WebDriverError, "Unable to obtain Selenium Manager binary for #{e.message}"
8793
end)
8894

8995
validate_location(location)

rust/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ pub trait SeleniumManager {
483483
} else {
484484
self.set_browser_version(discovered_version);
485485
}
486-
if self.is_webview2() {
486+
if self.is_webview2() && PathBuf::from(self.get_browser_path()).is_dir() {
487487
let browser_path = format!(
488488
r#"{}\{}\msedge{}"#,
489489
self.get_browser_path(),
@@ -1029,7 +1029,7 @@ pub trait SeleniumManager {
10291029
let mut commands = Vec::new();
10301030

10311031
if WINDOWS.is(self.get_os()) {
1032-
if !escaped_browser_path.is_empty() && !self.is_webview2() {
1032+
if !escaped_browser_path.is_empty() {
10331033
let wmic_command =
10341034
Command::new_single(format_one_arg(WMIC_COMMAND, &escaped_browser_path));
10351035
commands.push(wmic_command);

rust/src/logger.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use Color::{Blue, Cyan, Green, Red, Yellow};
3333
pub const DRIVER_PATH: &str = "Driver path: ";
3434
pub const BROWSER_PATH: &str = "Browser path: ";
3535

36-
#[derive(Default)]
36+
#[derive(Default, PartialEq)]
3737
enum OutputType {
3838
#[default]
3939
Logger,
@@ -219,6 +219,8 @@ impl Logger {
219219
let json = json_output.deref();
220220
if !json.logs.is_empty() {
221221
print!("{}", serde_json::to_string_pretty(json).unwrap());
222+
} else if self.output == OutputType::Json {
223+
panic!("JSON output has been specified, but no entries have been collected")
222224
}
223225
}
224226
}

0 commit comments

Comments
 (0)