io.netty.handler.codec.TooLongFrameException: HTTP content length exceeded 2097152 bytes. Exception with selenium and browsermob
Asked Answered
A

0

1

I started seeing below issue recently when i run my tests on chrome browser(selenium)

io.netty.handler.codec.TooLongFrameException: HTTP content length exceeded 2097152 bytes. at io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:241) ~[netty-all-4.0.42.Final.jar:4.0.42.Final] at io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:89) ~[netty-all-4.0.42.Final.jar:4.0.42.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) [netty-all-4.0.42.Final.jar:4.0.42.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367) [netty-all-4.0.42.Final.jar:4.0.42.Final]

 private DesiredCapabilities getDesiredCapabilitiesForSeleniumProxy() {
        DesiredCapabilities capabilities = DesiredCapabilities.chrome();    
        server = new BrowserMobProxyServer();
        server.setTrustAllServers(true);     
        server.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);
        server.start();
        server.addResponseFilter((response, content, info) -> {

            if (info.getOriginalUrl().endsWith("imports")) {
                try {
                    Id = parseJsonData(content.getTextContents());
                    JobId = getExternalJobId(content.getTextContents());
                } catch (JSONException e) {
                }
              }
        });
        Proxy proxy = ClientUtil.createSeleniumProxy(server);
        capabilities.setCapability(CapabilityType.PROXY, proxy);
        return capabilities;
    }

when i google, i got this below code. how can i add/use in my code. please help

server.addFirstHttpFilterFactory(new RequestFilterAdapter.FilterSource(filter, 16777216));
Ardrey answered 5/5, 2017 at 21:4 Comment(1)
Issue resolved. i used this ` public void addResponseFilter(ResponseFilter filter) { server.addLastHttpFilterFactory(new ResponseFilterAdapter.FilterSource(filter,16777216)); }`Ardrey

© 2022 - 2024 — McMap. All rights reserved.