Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds section to cy.screenshot() about Chromium tab activation behavior #5735

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/api/commands/screenshot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,17 @@ cy.screenshot()
cy.get('.sticky-header').invoke('css', 'position', null)
```

### Chromium-specific behavior with regard to tabs

Chromium will not capture screenshots when the Renderer process for the Cypress
tab is paused. This most often happens if a new tab was opened by clicking on
an anchor with `target="_blank"`. To accommodate capturing screenshots in this
situation, Cypress will attempt to activate the Cypress tab when a screenshot is
captured. We make our best effort to activate the tab via our Chromium extension.
If the extension is disabled, Cypress will force the main tab to the front. This
will cause the browser to steal focus in open mode. To prevent Cypress from
stealing focus, [ensure that the extension is enabled](/guides/references/troubleshooting#Allow-the-Cypress-Chrome-extension).

## Rules

### Requirements [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Chains-of-Commands) {#Requirements}
Expand Down