Skip to content

[BUG]: Healenium Proxy fails to establish session with Selenoid 1.11.3 — JsonException during /session call #16

@dkundu56

Description

@dkundu56

Describe the bug

📝 Bug Description:

While integrating Healenium Proxy with Selenoid 1.11.3, the proxy fails to create a new WebDriver session.
We have observed that during the POST /session call, Healenium Proxy throws:

org.openqa.selenium.json.JsonException: Unable to parse: You are using Selenoid 1.11.3!

The error suggests that the proxy incorrectly attempts to parse Selenoid’s banner message (plain text) as a JSON response, resulting in a 500 Internal Server Error.

📋 Logs:

2025-04-28 08:59:28.159  WARN - Init Session: You are using Selenoid 1.11.3!
2025-04-28 08:59:28.209 ERROR - AbstractErrorWebExceptionHandler: 500 Server Error for HTTP POST "/session"
org.openqa.selenium.json.JsonException: Unable to parse: You are using Selenoid 1.11.3!

⚡ Impact:
• No WebDriver session can be initialized through Healenium Proxy.
• Healing functionality is completely blocked.
• Tests fail at driver instantiation

📈 Possible Root Cause:
• Healenium Proxy assumes that any HTTP 200 response from the Selenium backend is valid JSON.
• However, Selenoid v1.11.3 returns a plain text banner (You are using Selenoid 1.11.3!) on root /status and sometimes on initial connection, which causes JSON parsing failure.

healenium-proxy.log

How to reproduce the issue

Steps: 
1. cd healenium
2. docker-compose -f docker-compose-selenoid.yaml up -d
3. python -m pytest ./tests/test_xpath.py

hlm-proxy logs:

2025-04-28 08:58:26.440  INFO 1 - [       main] .e.h.h.HealeniumProxyApplication : Started HealeniumProxyApplication in 6.116 seconds (process running for 7.739) 
2025-04-28 08:59:28.159  WARN 1 - [ttp-epoll-2] .InitSessionGatewayFilterFactory : Init Session: You are using Selenoid 1.11.3! 
2025-04-28 08:59:28.165  INFO 1 - [ttp-epoll-2] healenium                        : [Proxy] Using Selenium server: http://selenoid:4444/wd/hub 
2025-04-28 08:59:28.209 ERROR 1 - [ttp-epoll-2] AbstractErrorWebExceptionHandler : [f1d5e581-1]  500 Server Error for HTTP POST "/session" org.openqa.selenium.json.JsonException: Unable to parse: You are using Selenoid 1.11.3!\n

Logs appeared during using Healenium

Proxy Logs:

2025-04-28 08:58:26.440  INFO 1 - [       main] .e.h.h.HealeniumProxyApplication : Started HealeniumProxyApplication in 6.116 seconds (process running for 7.739) 
2025-04-28 08:59:28.159  WARN 1 - [ttp-epoll-2] .InitSessionGatewayFilterFactory : Init Session: You are using Selenoid 1.11.3! 
2025-04-28 08:59:28.165  INFO 1 - [ttp-epoll-2] healenium                        : [Proxy] Using Selenium server: http://selenoid:4444/wd/hub 
2025-04-28 08:59:28.209 ERROR 1 - [ttp-epoll-2] AbstractErrorWebExceptionHandler : [f1d5e581-1]  500 Server Error for HTTP POST "/session" org.openqa.selenium.json.JsonException: Unable to parse: You are using Selenoid 1.11.3!\n 	at org.openqa.selenium.json.Json.toType(Json.java:169)\n 	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: \n Error has been observed at the following site(s):\n 	*__checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]\n 	*__checkpoint ⇢ HTTP POST "/session" [ExceptionHandlingWebHandler]\n Original Stack Trace:\n 		at org.openqa.selenium.json.Json.toType(Json.java:169)\n 		at org.openqa.selenium.json.Json.toType(Json.java:152)\n 		at com.epam.healenium.healenium_proxy.mapper.JsonMapper.getValue(JsonMapper.java:63)\n 		at com.epam.healenium.healenium_proxy.service.SessionContextService.enrichSessionContext(SessionContextService.java:76)\n 		at com.epam.healenium.healenium_proxy.service.SessionContextService.submitSessionContext(SessionContextService.java:70)\n 		at com.epam.healenium.healenium_proxy.filter.InitSessionGatewayFilterFactory.lambda$apply$0(InitSessionGatewayFilterFactory.java:31)\n 		at org.springframework.cloud.gateway.filter.factory.rewrite.ModifyResponseBodyGatewayFilterFactory$ModifiedServerHttpResponse.lambda$writeWith$0(ModifyResponseBodyGatewayFilterFactory.java:224)\n 		at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:132)\n 		at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:129)\n 		at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)\n 		at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:299)\n 		at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:337)\n 		at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097)\n 		at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:145)\n 		at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)\n 		at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)\n 		at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)\n 		at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415)\n 		at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:445)\n 		at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:499)\n 		at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:800)\n 		at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:115)\n 		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)\n 		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n 		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)\n 		at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)\n 		at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)\n 		at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)\n 		at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)\n 		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)\n 		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n 		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)\n 		at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407)\n 		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)\n 		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n 		at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)\n 		at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:799)\n 		at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:501)\n 		at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:399)\n 		at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994)\n 		at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n 		at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n 		at java.base/java.lang.Thread.run(Thread.java:1570)\n Caused by: org.openqa.selenium.json.JsonException: Unable to determine type from: Y. Last 1 characters read: Y, next 29 characters to read: ou are using Selenoid 1.11.3!\n Build info: version: '4.25.0', revision: '8a8aea2337'\n System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.10.14-linuxkit', java.version: '22.0.2'\n Driver info: driver.version: unknown\n 	at org.openqa.selenium.json.JsonInput.peek(JsonInput.java:166)\n 	at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:167)\n 	at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:146)\n 	at org.openqa.selenium.json.Json.toType(Json.java:206)\n 	at org.openqa.selenium.json.Json.toType(Json.java:167)\n 	at org.openqa.selenium.json.Json.toType(Json.java:152)\n 	at com.epam.healenium.healenium_proxy.mapper.JsonMapper.getValue(JsonMapper.java:63)\n 	at com.epam.healenium.healenium_proxy.service.SessionContextService.enrichSessionContext(SessionContextService.java:76)\n 	at com.epam.healenium.healenium_proxy.service.SessionContextService.submitSessionContext(SessionContextService.java:70)\n 	at com.epam.healenium.healenium_proxy.filter.InitSessionGatewayFilterFactory.lambda$apply$0(InitSessionGatewayFilterFactory.java:31)\n 	at org.springframework.cloud.gateway.filter.factory.rewrite.ModifyResponseBodyGatewayFilterFactory$ModifiedServerHttpResponse.lambda$writeWith$0(ModifyResponseBodyGatewayFilterFactory.java:224)\n 	at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:132)\n 	at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:539)\n 	at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:129)\n 	at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)\n 	at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:299)\n 	at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:337)\n 	at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097)\n 	at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:145)\n 	at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)\n 	at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)\n 	at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)\n 	at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415)\n 	at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:445)\n 	at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:499)\n 	at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:800)\n 	at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:115)\n 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)\n 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n 	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)\n 	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)\n 	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)\n 	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)\n 	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)\n 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)\n 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n 	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)\n 	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407)\n 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)\n 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n 	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)\n 	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:799)\n 	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:501)\n 	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:399)\n 	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994)\n 	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n 	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n 	at java.base/java.lang.Thread.run(Thread.java:1570)\n

Expected behavior

No response

Actual behavior

No response

Healenium Proxy version

2.1.1

Healenium Backend version

3.4.6

Selenium version

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions