I have a scenario where I need to click on a menu item ‘Account’ and in the drop-down click on the button ‘Settings’. Using the below code option but getting the error: ERRO[0057] Uncaught (in promise) waiting for navigation: timed out after 30s executor=shared-iterations scenario=ui
Version: k6 v0.46.0 (2023-08-14T13:23:26+0000/v0.46.0-0-gcbd9e9ad, go1.20.7, windows/amd64)
The same code works for me in Playwright without even using wait.
Code:
//Click on the Account Menu bar item - THIS WORKS
const myAccountButton = page.locator('[id="myAccount"]');
await Promise.all([page.waitForNavigation(), myAccountButton.click(),]);
//Click on the Settings drop down link - TRIED VARIOUS //LOCATORS
// const accountSettingsButton = page.locator('[id="accountSettings"]');
// const accountSettingsButton = page.locator('a[href="/account"]');
// const accountSettingsButton = page.locator('#myAccount_1077722406 > a.jut__DropdownMenu__link.jut__NavBarItem__active');
// const accountSettingsButton = page.locator('//div[@id="myAccount"]/div/a[1]');
const accountSettingsButton = page.locator('//div[@id=\'myAccount\']/div/a[1]');
await page.waitForSelector(accountSettingsButton, { state: 'visible',});
await Promise.all([page.waitForNavigation({
timeout: 30000,
waitUntil: 'domcontentloaded',
}),
accountSettingsButton.click(),
]);