Is there a way to bypass Chrome geolocation dialog in Protractor tests?

前端 未结 1 930
既然无缘
既然无缘 2021-01-29 00:12

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 procee

相关标签:
1条回答
  • 2021-01-29 01:12

    The solution to the problem is to pass "prefs": {'profile.default_content_setting_values.geolocation': 2} to capabilities object in your protractor.config.js

    Below 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 set default_content_setting_values.geolocation to 2 (not 1 or 0) to make it NOT prompt that dialog

    0 讨论(0)
提交回复
热议问题