You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
k6/browser does not able to handle multiple navigations when script click on a link or button
k6 version
k6.exe v0.54.0
OS
Windows
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Below is an example of use case:
GIVEN I launched 'www.abc.com' (suppose there is a link (About Us) on the page)
WHEN I click on 'About Us' link (the application navigates to 'www.abc.com/callback', then navigates to 'www.abc.com/aboutus')
WHEN I tried to click on an element on 'aboutus' page OR I tried to verify element visibility on aboutus page
Expected behaviour
THEN script should waitForSelector visible state, regardless of any change/redirect happen in application under test URLs.
Actual behaviour
THEN The test failed with below error(s)
ERRO[0018] Uncaught (in promise) clicking on "#locator-id": Inspected target navigated or closed executor=shared-iterations scenario=ui
ERRO[0019] Uncaught (in promise) waiting for selector "#locator-id": Cannot find context with specified id executor=shared-iterations scenario=ui
Example of script is as below
import { browser } from 'k6/browser';
export const options = {
scenarios: {
ui: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
}
export default async function() {
const context = await browser.newContext();
const page = await context.newPage();
try {
await page.goto('app-url'); //please find/create a website which would change the url at least 2 times when nevigation (from one to another page) happen
await page.locator('#login').type('username');
await page.locator('#password').type("password");
await page.locator('#button').click(),
await page.waitForSelector('#username', { state: 'visible' });
} finally {
await page.close();
}
}
The text was updated successfully, but these errors were encountered:
jsaujla
changed the title
k6/browser does not able to handle multiple navigations with a single action
k6/browser does not able to handle multiple navigations when I click on a link or button
Nov 11, 2024
jsaujla
changed the title
k6/browser does not able to handle multiple navigations when I click on a link or button
k6/browser does not able to handle multiple navigations when script click on a link or button
Nov 11, 2024
@jsaujla, thanks for filing this issue. I can replicate this issue.
We are about to release v0.55.0 of k6 (hopefully sometime this week), which contains a fix for locator.waitFor. With that you should have better luck at waiting for elements during a navigation.
Brief summary
k6/browser does not able to handle multiple navigations when script click on a link or button
k6 version
k6.exe v0.54.0
OS
Windows
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Below is an example of use case:
GIVEN I launched 'www.abc.com' (suppose there is a link (About Us) on the page)
WHEN I click on 'About Us' link (the application navigates to 'www.abc.com/callback', then navigates to 'www.abc.com/aboutus')
WHEN I tried to click on an element on 'aboutus' page OR I tried to verify element visibility on aboutus page
Expected behaviour
THEN script should waitForSelector visible state, regardless of any change/redirect happen in application under test URLs.
Actual behaviour
THEN The test failed with below error(s)
ERRO[0018] Uncaught (in promise) clicking on "#locator-id": Inspected target navigated or closed executor=shared-iterations scenario=ui
ERRO[0019] Uncaught (in promise) waiting for selector "#locator-id": Cannot find context with specified id executor=shared-iterations scenario=ui
Example of script is as below
The text was updated successfully, but these errors were encountered: