BrowserMobProxy和Selenium Grid

时间:2013-12-27 22:30:43

标签: bmp

我遇到了BMP和Se Grid的问题。当我在本地机器上运行测试时,我可以拦截所有响应,但是当我切换到Se Grid时,我无法获得任何响应。可能是什么问题以及如何解决它?

测试setUp:     代理代理= app.getProxyHelper()。getProxy();     capabilities.setCapability(CapabilityType.PROXY,proxy);     ....     public ProxyHelper(应用程序管理器)抛出异常{         this.manager =经理;         server = new ProxyServer(0);         server.start();         mylogger.setLevel(Level.WARNING);

    server.addRequestInterceptor(new HttpRequestInterceptor(){
        @Override
        public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
            mylogger.info("" + request.getRequestLine());
            post = "" + request.getRequestLine();
            request.removeHeaders("User_Agent");
        }
    });
    server.addResponseInterceptor(new HttpResponseInterceptor() {
        @Override
        public void process(HttpResponse response, HttpContext context) throws HttpException, IOException {
            lastStatusLine =  ("" + response.getStatusLine());
            lastResponceCode = response.getStatusLine().getStatusCode();
            try{
                int code = getLastResponseCode();
                checkWithRegExp(code);
            } catch(Exception e){}
            finally {
                server.clearDNSCache();
            }
        }
    });
}

提前感谢您的帮助!

0 个答案:

没有答案