Open magnattic opened 1 year ago
We're also bumping into this stupid popup that prevents a page element from being clicked.
Hi @magnattic , that does seem annoying! To be totally transparent, I don't see this issue being prioritized ahead of the extensive backlog. However we would definitely welcome external contributions that address this issue.
Until now I still haven't found a solution 🥲
Same issue here, but with the "Save credit card" popup in Chrome.
Now, I found this to work in Selenium Java.
ChromeOptions options = new ChromeOptions(); Map<String, Object> prefs = new HashMap<String, Object>(); prefs.put("profile.default_content_setting_values.notifications", 2); prefs.put("autofill.profile_enabled", false); options.setExperimentalOption("prefs", prefs);
WebDriver driver = new ChromeDriver(options);
This solves the issue for me:
// cypress.config.ts
import {defineConfig} from 'cypress'
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:8080',
setupNodeEvents(on, config) {
// prettier-ignore
on('before:browser:launch', (browser, launchOptions) => {
if (browser.family === 'chromium' && browser.name !== 'electron') {
// Disable Chrome's "Save address?" pop up
launchOptions.preferences.default.autofill.profile_enabled = false
// Disable Chrome's "Save password?" pop up
launchOptions.preferences.default.credentials_enable_service = false
launchOptions.preferences.default.profile.password_manager_enabled = false
// Disable Chrome's "Save card?" pop up
launchOptions.preferences.default.autofill.credit_card_enabled = false
// Disable Chrome's "Show downloads when they're done" option
launchOptions.preferences.default.download_bubble.partial_view_enabled = false
return launchOptions
}
})
return config
},
},
})
Would be great if Cypress applies these options by default.
But be careful! It seems chrome properties are cached.
Try to comment out these modifications and console.log(launchOptions.preferences.default)
– you will see these options are still applied. I tried cypress cache clear
command and also re-install Chrome, but nothing helped. Maybe someone can suggest how to clear this cache?
@sigerello Im trying your solution (copy paste), but getting error right away:
Cannot set properties of undefined (setting 'profile_enabled')
TypeError: Cannot set properties of undefined (setting 'profile_enabled')
Any ideas what Im missing ?
@AlexSdet, it seems launchOptions.preferences.default.autofill
is undefined
in your case, while it should be an object. Have no idea why.
Try optionally initialize it:
launchOptions.preferences.default.autofill ??= {}
launchOptions.preferences.default.autofill.profile_enabled = false
Same for launchOptions.preferences.default.profile
and launchOptions.preferences.default.download_bubble
in case you will face into the similar issue for these properties.
What would you like?
When my tests fills out an address form with Chrome as the browser, the following prompt pops up:
It would be great if this could be disabled altogether for cypress.
Why is this needed?
It overlaps the test window and has to be closed manually each time.
Other
During my google search, I found different ways this could be implemented:
autofill.profile_enabled
profile.default_content_setting_values.notifications
Not sure if any of those actually work, but might be worth a try.