I faced this problem, when automating an application with protractor.
Once I open a home page I get geolocation dialog with Block/Allow buttons, which didn't let proceed without selection either option
It turned out, that this dialog is not an instance of alert, that's why browser.switchTo().alert().confirm()
didn't work
Passing '--disable-notifications'
argument to Chrome also didn't solve the problem
Research online didn't give any positive results. How to solve it?
The solution to the problem is to pass
"prefs": {'profile.default_content_setting_values.geolocation': 2}
tocapabilities
object in your protractor.config.jsBelow is another option that does pretty much the same thing.
So chrome may take an argument
--user-data-dir=/tmp/chrome
which specifies profile to open chrome with. If profile doesn’t exist at specified directory it creates default one. Then if you open /tmp/chrome/Default/Preferences you’ll see an object with preferences. You needed to setdefault_content_setting_values.geolocation
to2
(not 1 or 0) to make it NOT prompt that dialog