Still new to a k6.
Struggling to write response to a file .
Running following code
import http from "k6/http";
import { check } from "k6";
import { parseHTML } from 'k6/html';
export const options = { vus: 1, iterations: 1, httpDebug: 'full', }
//
export default function () {
let the_url;
the_url = 'https://k6.io/';
getResponse(the_url);
}
//
export function getResponse(the_url){
const res = http.get(the_url);
const doc = parseHTML(res.body); // equivalent to res.html()
console.log('\tDBG: '+ doc);
}
outputting the response to a file k6 run ./_eg-.js 2>./logs/resp.html
i need to see the HTML file
getting large html file
6 : time="2022-11-30T22:20:35-05:00" level=info msg="Request:
GET / HTTP/1.1
Host: k6.io
User-Agent: k6/0.41.0 (https://k6.io/)
Accept-Encoding: gzip
" group= iter=0 request_id=c65a8c1a-fee7-4c89-573d-35540e8592f0 scenario=default source=http-debug vu=1 At line:1 char:1 + k6 run ./_eg-.js 2>./logs/resp.html + + CategoryInfo : NotSpecified: (time="2022-11-3...http-debug vu=1:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError time="2022-11-30T22:20:35-05:00" level=info msg="Response:
HTTP/2.0 200 OK
Content-Length: 498970
Age: 200900
Cache-Control: public, max-age=0, must-revalidate
Content-Type: text/html
Date: Mon, 28 Nov 2022 19:32:15 GMT
Etag: \"6734b9991402efbc87193ec834b1109d\"
Last-Modified: Mon, 28 Nov 2022 17:36:48 GMT
Server: AmazonS3
Vary: Accept-Encoding
Via: 1.1 5e2f1ed3ba0ab1e08304bb3d134360de.cloudfront.net (CloudFront)
X-Amz-Cf-Id: MS4A7Rh1MDrbb90KgM29vVgJHfPV6tfWPTZ47Pkj0OchdPzAt0QHIA==
X-Amz-Cf-Pop: YTO50-P2
X-Cache: Hit from cloudfront
What do i do wrong