Error : Navigation interrupted by another one

Hello everyone and happy new year !

I am working on a project, but often got the following error “navigation interrupted by another one”.
The console then outputs as shown below :

Here’s the full code (except confidential URL :slight_smile: ) :

import launcher from 'k6/x/browser';
import { check, sleep, async, } from 'k6';

/****************************************************************************************/
/****************************************************************************************/

// Pacing : Nouvelle itération toutes les 10sec

export default function() {
    const browser = launcher.launch('chromium', { headless: false });
    const context = browser.newContext({ignoreHTTPSErrors: false });
    let page = context.newPage();

    // Start transaction : S_***_01 URL
    //--> Navigation vers l'url
    page.goto('URL', { waitUntil: 'networkidle' });
    // End transaction : S_***_01 URL

    // Start transaction : S_***_02 Fermer Popup
    //--> Cliquer sur le bouton de fermeture
    page.click('id=close-modal');
    // End transaction : S_***_02 Fermer Popup

    // ** wait 2sec **
    sleep(2);

    //--> Check button with id 'status-ligne0' contains "En serv."
    var btn1Txt = page.innerText('id=status-ligne0')
    if (btn1Txt == "En serv."){
        console.log("success");
    }else {
        console.log("fail");
    }

    //--> Click "En serv." button
    page.click('id=status-ligne0');

    // ** wait 500 millisec **
    sleep(0.5);

    // --> Check 'span[class=dash]' button contains "-"
    var btn2Txt = page.innerText('span[class=dash]');
    if (btn2Txt == '-'){
        console.log("Success");
    }else {
        console.log("Fail");
    }

    // --> Click 'span[class=dash]' button
    page.click('span[class=dash]');

    //--> Scroll vertically by 855 px
    page.mouse.wheel(0, 855);

    // ** wait 2sec **
    sleep(2);

    // --> Check 'acts-block' div contains "Actes / outils conseillers" text
    var div1Txt = page.innerText('id=acts-block');
    if (div1Txt == 'Actes / outils conseillers'){
        console.log("Success");
    }else {
        console.log("Fail");
    }

    // --> Click "achats" button
    page.click('id=btn-Achats');

    // --> Click "Acquérir une offre" button
    // Can't find this button yet :/

    
    
    

    // Start transaction : S_H2H_07 MoyenContact
    //--> 
    // End transaction : S_H2H_07 MoyenContact

    // Start transaction : S_H2H_08 Fermer
    //--> 
    // End transaction : S_H2H_08 Fermer
    
    page.close();
    browser.close();
}

So I was wondering where could this error come from, and how to solve it :slight_smile:

Echape

1 Like

Hi Echape,

Thanks for reporting this problem. Can you try this on another non-confidential website that produces the same issue? Then share website’s url with me?

I know I’m asking a lot but I need to run this myself to reproduce the issue, and hopefully fix it.

If that’s not possible, can I suggest you playing with page.waitForNavigation() instead of sleep?

1 Like

Hi inanc, thanks for answering that fast !

I reproduced the same error by navigating to https://www.amazon.fr, but the “navigation interrupted by another one” error was actually due to bad proxy configuration on my side.

The remaining errors are non-blocking ones, such as “No data found for resource with given identifier” (already reported) :

1 Like

NB : Using page.waitForNavigation() triggers a ‘Timed out’ exception preventing the script to end ‘properly’ (prehaps navigation’s end isn’t detected because of previous errors) :


Hope theses issues are fixable :)

Have a nice day,

Echape

1 Like

Hi Echape,

You’re welcome, and thanks for reporting these issues. Glad to see that you fixed the initial error.

We have a fix for the “context not found” issue in the next release. Please keep posting your findings; helpful!

Thanks!

1 Like