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

谁说我不能喝 提交于 2019-12-11 04:44:57

问题


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));

来源:https://stackoverflow.com/questions/43813715/io-netty-handler-codec-toolongframeexception-http-content-length-exceeded-20971

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!