Angular SPA application http.get(link)

I have Angular application and I have written following k6 code for get response.

let response = http.get(link)
console.log('registration page status: ', response .status) ==> getting returns 200
console.log('registration page response: ', response .body)

response .body I am getting only

"<app-root></app-root> "

instead of all html like submit button, text etc.

<!DOCTYPE html>
<html lang="en">)
    <meta charset="utf-8" />
    <title>Patient Portal Access</title>
    <base href="/" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="icon" type="image/x-icon" href="favicon.ico" />


  <script src="runtime.js" defer></script><script src="polyfills-es5.js" nomodule defer></script><script src="polyfills.js" defer></script><script src="styles.js" defer></script><script src="scripts.js" defer></script><script src="main.js" defer></script>

Any one can help me to resolve this issue.

k6 is not a browser and it can’t evaluate the JavaScript on the web pages. A tool like Selenium or Cypress or one of the many others is probably what you’d want for that.

However, these tools are generally quite CPU heavy and aren’t always suitable to load test a website. Instead, developers often record the HTTP traffic that their JavaScript applications generate and replay it with k6 with many VUs, to simulate load. You can do that by recording a .HAR file from your browser and converting it to a k6 script with our HAR converter. More details:

1 Like

thank you for your quick replay .