2
我試圖使用BrowserMob proxy來監視由WebDriver(Selenium)瀏覽器發送的請求。BrowserMob代理和主機文件
我實例代理有:
server = new ProxyServer(localProxyPort);
server.start();
然後,我創建這將使用這個代理的Firefox配置文件:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 1);
profile.setPreference("network.proxy.http", "localhost");
profile.setPreference("network.proxy.http_port", localProxyPort);
我的問題是,我有不同的主機映射了很多我「主人'文件。 BrowserMob代理忽略系統主機文件,並嘗試自行解析ips。
有一個解決方案:
server.remapHost("somehost.com", "127.0.0.1");
,但我不能這樣做對每一臺主機。有沒有辦法強制代理使用我的系統主機映射?
謝謝!
Leonti
我知道,我的意思是「我不能爲每個主機做」是我有(有:) :)太多的映射把他們的每一個在.remapHost()函數。 – Leonti
您可以自動將主機文件轉換爲remapHost配置行。 –