Search code examples
javaselenium-webdriverselenium4qaf

QAF | Selenium 4 is not working with QAF version 3.2.0


I'm not able to use Selenium 4 with the QAF version 3.2.0. Url is not opening after browser open (Blank page). Test is working fine if I downgrade the selenium version to 3.141.59.

Note: OS: Mac OSX Java Version: 17 I have tried Selenium version 4.0.0, 4.1.2, 4.11.0

    <sourceVersion>1.8</sourceVersion>
    <targetVersion>1.8</targetVersion>
    <qaf.version>3.2.0</qaf.version>
    <selenium.version>3.141.59</selenium.version>
    <selenium.version>4.0.0</selenium.version>

ERROR:

Aug 15, 2023 11:20:20 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C Aug 15, 2023 11:20:20 PM org.openqa.selenium.remote.http.WebSocket$Listener onError WARNING: Invalid Status code=403 text=Forbidden java.io.IOException: Invalid Status code=403 text=Forbidden at org.asynchttpclient.netty.handler.WebSocketHandler.abort(WebSocketHandler.java:92) at org.asynchttpclient.netty.handler.WebSocketHandler.handleRead(WebSocketHandler.java:118) at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:78) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:311) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:432) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) 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.base/java.lang.Thread.run(Thread.java:833)

Unable to create driver instance in 1st attempt with retry timeout of 0 seconds. You can check/set value of 'driver.init.retry.timeout' appropriately to set retry timeout on driver initialization failure.Unable to Create Driver Instance for chrome: Unable to establish websocket connection to http://localhost:62671/devtools/browser/a7e95bd5-94a4-4089-9c14-aa0d6e9427c0
Build info: version: '4.0.0', revision: '3a21814679'
System info: host: 'XXXXX-MacBook-Pro.local', ip: 'fe80:0:0:0:14e0:460c:5f80:9dbc%en0', os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '13.4', java.version: '17.0.8'
Driver info: driver.version: ChromeDriver
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.84 sec <<< FAILURE!
Preparing For Shut Down...
Result updator: Completed 1 Remaining 0 result to be update.

Results :

Failed tests:   Testing Google.com(com.qmetry.qaf.automation.step.client.Scenario): Timed out after 0 seconds: Unable to create driver instance in 1st attempt with retry timeout of 0 seconds. You can check/set value of 'driver.init.retry.timeout' appropriately to set retry timeout on driver initialization failure.

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.398 s
[INFO] Finished at: 2023-08-15T23:20:21+10:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on project qaf-blank-project-maven: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/Documents/Automation/qaf-blank-project-maven-master/test-results/15_Aug_2023_01_20_pm for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
XXXX@XXXXX-MacBook-Pro qaf-blank-project-maven-master % 

I have tried different versions of Selenium 4


Solution

  • This looks duplicate of Java.io.IOException: Invalid Status code=403 text=Forbidden

    As a side note:

    If you are using selenium 4, you should try latest version of selenium (4.11.0 as of today). Below is selenium version compatibility for qaf:

    • QAF 3.2.0 supports selenium 3.6.0 to 4.3.x
    • QAF 4.0.0-RC1 supports selenium 4.0.0 to latest (4.11.0 as of today)

    So if you are using selenium 4.11.0 you need to use QAF 4.0.0-RC1.