我已在Chrome WebDriver中启用了PERFORMANCE日志记录。它的捕获请求和响应流量。但是响应的主体丢失了,只捕获了标题,时间信息。响应类型为Fetch
selenium-java version : 3.6
Driver version : selenium/standalone-chrome:3.8.1
代码段就是这样,
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
LoggingPreferences logPref = new LoggingPreferences();
logPref.enable(LogType.PERFORMANCE, Level.ALL);
capabilities.setCapability(CapabilityType.LOGGING_PREFS, logPref);
Map<String, Object> perfLogPrefs = new HashMap<String, Object>();
perfLogPrefs.put("enableNetwork", true);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("perfLoggingPrefs", perfLogPrefs);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new RemoteWebDriver(url, getCapabilities())
响应是这样的
Network.responseReceived {
"frameId": "(5E32E9E7FBF69A4DB1EA649C671E1840)",
"loaderId": "(47DA896570956A7238312B7A044024D7)",
"requestId": "4857.105",
"response": {
"connectionId": 548,
"connectionReused": true,
"encodedDataLength": 47,
"fromDiskCache": false,
"fromServiceWorker": false,
"headers": {
"atl-vtm-backend-time": "1670",
"atl-vtm-queue-time": "0",
"atl-vtm-time": "1670",
"cache-control": "no-cache, no-store, max-age=0, must-revalidate",
"cde-service": "billing-ux-service",
"cde-target": "https://billing-ux-service.staging.io",
"cde-type": "DEFAULT",
"content-length": "603",
"content-type": "application/json;charset=UTF-8",
"date": "Wed, 14 Feb 2018 04:58:52 GMT",
"expires": "0",
"pragma": "no-cache",
"status": "200",
"strict-transport-security": "max-age=315360000; includeSubDomains; preload",
"x-content-type-options": "nosniff",
"x-frame-options": "DENY",
"x-xss-protection": "1; mode=block"
},
"mimeType": "application/json",
"protocol": "h2",
"remoteIPAddress": "104.192.142.74",
"remotePort": 443,
"requestHeaders": {
":authority": "test-1518577270615-208.dev.com",
":method": "GET",
":path": "/admin/rest/billing-ux/api/billing/bill-estimate",
":scheme": "https",
"accept": "application/json",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-US,en;q=0.9",
"content-type": "application/json",
"cookie": "blah-blah",
"referer": "https://test-1518577270615-208.dev.com/admin/billing/applications?chrome=false&react=false",
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36"
},
"securityDetails": {
"certificateId": 0,
"cipher": "AES_128_GCM",
"issuer": "DigiCert SHA2 High Assurance Server CA",
"validFrom": 1469404800,
"validTo": 1534507200
},
"securityState": "secure",
"status": 200,
"statusText": "",
"timing": {
"connectEnd": -1,
"connectStart": -1,
"dnsEnd": -1,
"dnsStart": -1,
"proxyEnd": -1,
"proxyStart": -1,
"pushEnd": 0,
"pushStart": 0,
"receiveHeadersEnd": 1963.64500001073,
"requestTime": 407491.206811,
"sendEnd": 0.937999982852489,
"sendStart": 0.484999967738986,
"sslEnd": -1,
"sslStart": -1,
"workerReady": -1,
"workerStart": -1
},
"url": "https://test-1518577270615.208-dev.com/admin/rest/billing-ux/api/billing/bill-estimate"
},
"timestamp": 407493.170997,
"type": "Fetch"
}