-
Notifications
You must be signed in to change notification settings - Fork 453
Open
Description
Description
When clicking a button/link that opens a new tab (with target="_blank"), which then performs multiple redirects (e.g., authentication flow), focus does not consistently switch to the newly opened tab.
The new tab opens successfully in the background, but focus randomly remains on the old tab instead of switching to the new one. This behavior is intermittent - sometimes it works correctly, sometimes it doesn't.
Steps to Reproduce
- Have a page with a link/button that opens a new tab
- The opened tab performs multiple redirects (e.g., OAuth/SSO authentication flow with 3-5 redirects)
- Observe which tab has focus after the redirects complete
Expected Behavior
Focus should consistently switch to the newly opened tab after it finishes loading (including all redirects).
Actual Behavior
Focus randomly stays on the original tab. The new tab opens in the background, but doesn't become the active tab. This happens inconsistently - approximately 40-60% of the time in my tests.
Environment
- Taiko version: 1.4.6
- Node.js version: 20.x
- OS: Windows Server 2016
- Browser: Chrome for testing 140.0.7339.82 (bundled with Taiko)
Additional Context
- The issue is more pronounced when the new tab has multiple redirects (authentication flows)
- With simple pages (no redirects), the issue still occurs but less frequently
- Using
switchTo()after the click is a workaround, but it's not reliable because timing is difficult to predict with redirects
Regression Information
- Taiko 1.4.4 with custom Chromium 120.0.6099.0 (dev build): ✅ Issue did not occur
- Taiko 1.4.6 with bundled browser (Chrome 140.0.7339.82): ❌ Issue became critical and occurs frequently (40-60% of the time)
Sample Code
await openBrowser();
await goto('https://example.com');
// Click button that opens new tab with auth redirects
await click(button('Login in New Tab'));
// Expected: Focus is on the new tab
// Actual: Focus randomly stays on old tabMetadata
Metadata
Assignees
Labels
No labels