0

Please find the Error Log Line :

ChromeDriver was started successfully.
Mar 14, 2023 12:13:48 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:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:336)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:323)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:444)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280)

Code for opening separate duplicate browser in different port address

public static void chromeSetup() {
    WebDriverManager.chromedriver().setup();
    ChromeOptions opt = new ChromeOptions();

    opt.setExperimentalOption("debuggerAddress", "localhost:9988");
    driver = new ChromeDriver(opt);
    
}

chromeSetup() is implemented in other methods and classes starting while trying to open url for eg:

      if (reportType.equals("Y") || reportType.equals("y")) {
            chromeSetup();
            driver.get("sample url");
            exportButton();

            mainKey();

        } else if (reportType.equals("N") || reportType.equals("n")) {

            mainKey();

        }
nayansFosgit
  • 69
  • 1
  • 7
  • Does this answer your question? [java.io.IOException: Invalid Status code=403 text=Forbidden](https://stackoverflow.com/questions/75678572/java-io-ioexception-invalid-status-code-403-text-forbidden) – Rolandas Ulevicius Mar 14 '23 at 08:04
  • @RolandasUlevicius yes it works only if i don't want to run on separate browser instance, but it throws same error while trying to run on separate browser instance which is running on localhost:9988. – nayansFosgit Mar 14 '23 at 09:12

1 Answers1

3

You just need to add this option and it will work

options.addArguments("--remote-allow-origins=*");