[🐛 Bug]: Selenium 4 integration with Sauce Labs
See original GitHub issueWhat happened?
Hi, I am trying to run the test scripts developed using Selenium 4 in sauce labs but getting “Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.”
I took the sample scripts from official documentation from sauce labs and passed userid, accesskey and proxy but still getting error
Pls help me to get resolve this issue. Thanks
How can we reproduce the issue?
public class RunMethod {
public static void main(String[] args) throws MalformedURLException {
String sauce_userid ="TestUser";
String sauce_accesskey="TestPassword";
// String URL = "http://" + sauce_userid + ":" + sauce_accesskey+"@ondemand.saucelabs.com:80/wd/hub";
Proxy proxy = new Proxy();
ChromeOptions options = new ChromeOptions();
options.setPlatformName("Windows 10");
options.setBrowserVersion("latest");
proxy.setHttpProxy("TestProxy:8080");
options.setCapability("proxy", proxy);
Map<String, Object> sauceOptions = new HashMap<String, Object>();
sauceOptions.put("username", sauce_userid);
sauceOptions.put("accessKey", sauce_accesskey);
sauceOptions.put("Test name", "Selenium 4 Integration with sauce labs");
options.setCapability("sauce:options", sauceOptions);
URL url = new URL("http://ondemand.saucelabs.com:80/wd/hub");
WebDriver driver = new RemoteWebDriver(url, options);
driver.get("https://www.google.com");
System.out.println(driver.getTitle());
}
}
Relevant log output
Jul 08, 2022 12:51:18 PM org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer createTracer
INFO: Using OpenTelemetry for tracing
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.1.4', revision: '535d840ee2'
java.version: '1.8.0_172'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, browserVersion: latest, goog:chromeOptions: {args: [], extensions: []}, platformName: windows 10, proxy: {httpProxy: .root.corp..., proxyType: manual}, sauce:options: {Test name: Selenium 4 Integration with..., accessKey: ..., username: sso-accounts-...}}], desiredCapabilities=Capabilities {browserName: chrome, browserVersion: latest, goog:chromeOptions: {args: [], extensions: []}, platformName: Windows 10, proxy: Proxy(manual, http=cproxy..., sauce:options: {Test name: Selenium 4 Integration with..., accessKey: ..., username: sso-accounts-...}}}]
Capabilities {}
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:585)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:248)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:164)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:146)
at SampleSauceLabsCode.SampleSauceLabsCode.RunMethod.main(RunMethod.java:43)
Caused by: java.io.UncheckedIOException: java.io.IOException: Stream closed
at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:73)
at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:49)
at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:97)
at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:55)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567)
... 4 more
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
at java.io.BufferedInputStream.reset(BufferedInputStream.java:446)
at org.asynchttpclient.netty.request.body.NettyInputStreamBody.write(NettyInputStreamBody.java:61)
at org.asynchttpclient.netty.request.NettyRequestSender.writeRequest(NettyRequestSender.java:433)
at org.asynchttpclient.netty.channel.NettyConnectListener.writeRequest(NettyConnectListener.java:80)
at org.asynchttpclient.netty.channel.NettyConnectListener.onSuccess(NettyConnectListener.java:156)
at org.asynchttpclient.netty.channel.NettyChannelConnector$1.onSuccess(NettyChannelConnector.java:92)
at org.asynchttpclient.netty.SimpleChannelFutureListener.operationComplete(SimpleChannelFutureListener.java:26)
at org.asynchttpclient.netty.SimpleChannelFutureListener.operationComplete(SimpleChannelFutureListener.java:20)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:578)
at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:571)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:550)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:491)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:616)
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:605)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104)
at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:300)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:335)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:710)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc"
Operating System
Windows 10
Selenium version
latest
What are the browser(s) and version(s) where you see this issue?
latest
What are the browser driver(s) and version(s) where you see this issue?
RemoteWebDriver
Are you using Selenium Grid?
No response
Issue Analytics
- State:
- Created a year ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Upgrading to Selenium 4 for Sauce Labs Testing
This doc will guide you through how to upgrade to Selenium 4, which was released in late 2021.
Read more >A Comprehensive Guide to Selenium 4 - Sauce Labs
Bidirectional APIs in Selenium 4 will allow you to intercept network requests, mock backends, perform basic authentication, view the console logs, and more....
Read more >Selenium on Sauce Labs
The Selenium browser automation tool allows you to write test code that runs through all the possible actions in your web app faster...
Read more >How To Upgrade to Selenium 4 - Sauce Labs
Upgrading to Selenium 4 should be a painless process if you are using one of the officially supported languages (Ruby, JavaScript, C#, Python, ......
Read more >Selenium Grid and Sauce Labs
Selenium Grid helps with this by allowing concurrent execution of WebDriver tests across different browsers, platforms, and devices on multiple ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@diemol @titusfortner Hello All, Thanks for your help. I am able to integrate selenium 4 with sauce labs. Thanks
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.