Skip to content

[🐛 Bug]: SeleniumManager (Java): Calling 'getBinaryPaths' with an immutable arguments list results in UnsupportedOperationException #14034

@sbabcoc

Description

@sbabcoc

What happened?

I'm using the getBinaryPaths(List<String>) function of SeleniumManager to acquire the path of driver binaries. The current implementation assumes that the list provided by the client is mutable. If an immutable list is specified, the function fails with UnsupportedOperationException.

How can we reproduce the issue?

public static File findDriver(String browserName) {
    SeleniumManager manager = SeleniumManager.getInstance();
    Result result = manager.getBinaryPaths(Arrays.asList("--browser", browserName));
    return new File(result.getDriverPath());
}

The call to getBinaryPaths() throws UnsupportedOperationException, because the current implementation of this function attempts to add its own arguments to the list provided by the client.

Relevant log output

java.lang.UnsupportedOperationException
	at java.base/java.util.AbstractList.add(AbstractList.java:153)
	at java.base/java.util.AbstractList.add(AbstractList.java:111)
	at org.openqa.selenium.manager.SeleniumManager.getBinaryPaths(SeleniumManager.java:235)
	at com.nordstrom.automation.selenium.utility.BinaryFinder.findDriver(BinaryFinder.java:26)
	at com.nordstrom.automation.selenium.plugins.ChromeCaps.getPropertyNames(ChromeCaps.java:63)
	at com.nordstrom.automation.selenium.plugins.ChromePlugin.getPropertyNames(ChromePlugin.java:57)
	at com.nordstrom.automation.selenium.plugins.RemoteWebDriverPlugin.create(RemoteWebDriverPlugin.java:49)
	at com.nordstrom.automation.selenium.DriverPlugin.create(DriverPlugin.java:91)
	at com.nordstrom.automation.selenium.core.LocalSeleniumGrid.create(LocalSeleniumGrid.java:144)
	at com.nordstrom.automation.selenium.core.SeleniumGrid.create(SeleniumGrid.java:174)
	at com.nordstrom.automation.selenium.AbstractSeleniumConfig.getSeleniumGrid(AbstractSeleniumConfig.java:630)
	at com.nordstrom.automation.selenium.AbstractSeleniumConfig.getCurrentCapabilities(AbstractSeleniumConfig.java:761)
	at com.nordstrom.automation.selenium.platform.TargetType.matches(TargetType.java:51)
	at com.nordstrom.automation.selenium.platform.TargetPlatformHandler.shouldRun(TargetPlatformHandler.java:46)
	at com.nordstrom.automation.selenium.listeners.PlatformInterceptor.intercept(PlatformInterceptor.java:45)
	at org.testng.TestRunner.intercept(TestRunner.java:821)
	at org.testng.TestRunner.privateRun(TestRunner.java:740)
	at org.testng.TestRunner.run(TestRunner.java:603)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:429)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:423)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:383)
	at org.testng.SuiteRunner.run(SuiteRunner.java:326)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1249)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.runSuites(TestNG.java:1092)
	at org.testng.TestNG.run(TestNG.java:1060)
	at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)


### Operating System

Windows 10, but this is not an OS-specific issue

### Selenium version

Java 4.21.0

### What are the browser(s) and version(s) where you see this issue?

Chrome for Testing 123.0.6312.86 (Official Build) (64-bit)

### What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver

### Are you using Selenium Grid?

4.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-javaJava BindingsI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions