-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[Feature] Tell the browser playwright is running it #19584
Comments
pw have bunch of globally injected variables like you can use it 🙌🏽 |
The answer above is not correct, recorder is not there when codegen is not recording. You can do something like this: test.beforeEach(({ context }) => {
await context.addInitScript(() => window.isUnderTest = true);
}); then in your page, you can do if (window.isUnderTest) ... |
Closing as per above, please feel free to open a new issue if this does not cover your use case. |
For everyone else who come to solve the same issue, use navigate.webdriver property. You don't need to set anything from playwright |
I want my app to know it's running under playwright, one use case is running tests on production environment, and telling the html to NOT load google analytics and other trackers.
How can I go about it?
The text was updated successfully, but these errors were encountered: