Xk6 browser failed to load resource, 404, url=url+'~js/bootstrap.min.js'

I am new to k6 and xk6 testing, and have limited knowledge of computer science and front end development.

When I run an xk6 test I get the error ‘Failed to load resource: the server responded with a status of 404 () browser_source=network line_number=0 source=browser stacktrace=“” url=“https://{site-being-tested}.com/account/~js/bootstrap.min.js”’

I’ve attempted to run similar tests using k6 example scripts, against sites I use personally, and on a second laptop. The test proceeds after the error (as far as I can tell). Is there a context, launch or other setting for addressing this error? Is it expected/something that can be ignored?

COMMAND
$ xk6-browser run Browser/browser-test.js

ERRO[0012] Failed to load resource: the server responded with a status of 404 () browser_source=network line_number=0 source=browser stacktrace=“” url=“https://{site-being-tested}.com/account/~js/bootstrap.min.js”
WARN[0013] “jQuery.Deferred exception: $(…).tooltip is not a function” …

TEST FILE

import launcher from ‘k6/x/browser’
import { sleep } from ‘k6’;

export default function() {

const browser = launcher.launch('chromium', {
devtools: false,             // Open up developer tools in the browser by default
headless: false,            // Show browser UI or not
slowMo: '500ms',            // Slow down input actions and navigations by specified time
timeout: '30s',             // Default timeout to use for various actions and navigations
});

console.log('completed browser launch line');
const context = browser.newContext({
    acceptDownloads: true,             // Whether to accept downloading of files by default
});

const page = context.newPage();

sleep(3);

var startUrl = "https://{site-being-tested}";//K6 is going to a different url  "{site-being-tested}/~js/bootstrap.min.js"

sleep(3);
page.goto(startUrl, { waitUntil: 'networkidle'});
sleep(3);

page.$('input[name="UserId"]').type('{userid}')
sleep(3);

page.$('input[name="Password"]').type('{password}');
sleep(3);

page.$('{css submit button}').click();
sleep(3);

page.$('button.{hamburger-menu}').click();
sleep(2);

page.$('{css-selector}').click();
sleep(2);

page.waitForLoadState('networkidle');

page.close();

browser.close();

}

Hi Johnathan,

An HTTP response status code of 404 Not Found means that the requested resource wasn’t found on the server you’re testing.

Since you didn’t request bootstrap.min.js directly, that means that the startUrl’s HTML specified it, and the browser received that response when it tried to load it.

You should be able to see the same error if you load the web site manually in your browser without xk6-browser, open the DevTools console (F12 or Ctrl+Shift+I) and check the Network tab.

This is something you’ll have to fix on the server and not something we can help you with here.

Good luck!

1 Like

I have same problem. The error on the page is not important. I want to ignore it.

Failed request is just an icon