Skip to content
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

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

Closed
sbabcoc opened this issue May 24, 2024 · 2 comments · Fixed by #14036

Comments

@sbabcoc
Copy link
Contributor

sbabcoc commented May 24, 2024

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
Copy link

@sbabcoc, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants