Description
When running latest Selenium 4.41 in an Java OSGi environment, IllegalArgumentException is thrown from method Read.resourceAsString.
Read.class.getResourceAsStream(resource) can only load resources accessible from the class loader of this class. This currently limits it the selenium-api JAR/OSGi bundle.
One option would be to move the Read class into selenium-remote-driver JAR/OSGi bundle where the resources (.js files) are located.
Reproducible Code
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//body")));
Debugging Logs
org.openqa.selenium.remote.UnreachableBrowserException:
Error communicating with the remote browser. It may have died.
Build info: version: '4.41.0', revision: '9fc754f'
System info: os.name: 'Windows Server 2022', os.arch: 'amd64', os.version: '10.0', java.version: '25.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [96fc25d881898671b536eeccf3c58ab9, isElementDisplayed [id]]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 146.0.7680.80, chrome: {chromedriverVersion: 146.0.7680.165 (4b989da09e1...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:50001}, pageLoadStrategy: normal, platformName: any, proxy: Proxy(), se:cdp: ws://localhost:50001/devtoo..., se:cdpVersion: 146.0.7680.80, setWindowRect: false, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Element: [[ChromeDriver: chrome on any (96fc25d881898671b536eeccf3c58ab9)] -> xpath: //body]
Session ID: 96fc25d881898671b536eeccf3c58ab9
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:640)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:223)
at org.openqa.selenium.remote.RemoteWebElement.isDisplayed(RemoteWebElement.java:282)
at org.openqa.selenium.support.ui.ExpectedConditions.elementIfVisible(ExpectedConditions.java:365)
at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:222)
at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:215)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:209)
at Test Code
Caused by: java.lang.IllegalArgumentException: Resource not found: /org/openqa/selenium/remote/isDisplayed.js
at org.openqa.selenium.io.Read.resourceAsString(Read.java:59)
at org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec.lambda$executeAtom$2(W3CHttpCommandCodec.java:366)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1724)
at org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec.executeAtom(W3CHttpCommandCodec.java:362)
at org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec.amendParameters(W3CHttpCommandCodec.java:272)
at org.openqa.selenium.remote.codec.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:238)
at org.openqa.selenium.remote.codec.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:113)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:211)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:216)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:174)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
... 7 more
ℹ️ Last known working version: 4.39
Description
When running latest Selenium 4.41 in an Java OSGi environment,
IllegalArgumentExceptionis thrown from methodRead.resourceAsString.Read.class.getResourceAsStream(resource)can only load resources accessible from the class loader of this class. This currently limits it the selenium-api JAR/OSGi bundle.One option would be to move the Read class into selenium-remote-driver JAR/OSGi bundle where the resources (.js files) are located.
Reproducible Code
Debugging Logs
ℹ️ Last known working version:
4.39