Protractor Chrome Allow Notifications #2626

Closed
rfodge opened this Issue Oct 22, 2015 · 13 comments

Projects

None yet

5 participants

@rfodge
rfodge commented Oct 22, 2015

Chrome just auto-updated to version 46. I am trying to run my protractor tests but I always get the Allow Notifications pop-up now. Does anyone know how to get around this? How I can make it always allow notifications for my tests?

allownotifications

Is there a chrome option or something that we can set in the config file?

@sjelin
Contributor
sjelin commented Oct 22, 2015

Not sure about this, but could you use browser.switchTo().alert().accept() to accept the notification?

@rfodge
rfodge commented Oct 22, 2015

Thanks for the suggestion - I tried that but didn't work.

@jlin412
jlin412 commented Oct 22, 2015

I have similar issue with geo location popup. I don't think that the approach will work because it is browser native alert. I haven't found a solution yet either. It seems to be a problem for new Chrome browser 46 or the latest chrome driver. I already set it in browser setting to accept all sites for geo location. New browser from protractor only takes default setting where I have to click to accept.

screen shot 2015-10-22 at 4 19 13 pm

@rfodge
rfodge commented Oct 22, 2015

Yeah, I tried searching for a Chrome Option to set it to allow via the protractor config file but I couldn't find one. However, to get around it for now, I was able to run Chrome in incognito mode via an option and that must always allow notifications. Maybe you could try that as well as a workaround for now until someone else lets us know of a solution?

image

@jlin412
jlin412 commented Oct 22, 2015

I try to run in incognito mode but geo location popup is there for me :(

On Thu, Oct 22, 2015 at 4:52 PM, rfodge notifications@github.com wrote:

Yeah, I tried searching for a Chrome Option to set it to allow via the
protractor config file but I couldn't find one. However, to get around it
for now, I was able to run Chrome in incognito mode via an option and that
must always allow notifications. Maybe you could try that as well as a
workaround for now until someone else lets us know of a solution?

[image: image]
https://cloud.githubusercontent.com/assets/11653643/10677937/467b5f24-78dd-11e5-8865-f8c6b7389059.png


Reply to this email directly or view it on GitHub
#2626 (comment)
.

@sjelin
Contributor
sjelin commented Oct 23, 2015

This is definitely possible via chromeOptions using perfs. I've looked at my preferences files and the memory of which sites I've enabled geolocation for is definitely there. It's a huge file though so exactly what to include in your config I'm not sure, but I know the option exists. Hope that helps!

@sjelin sjelin closed this Oct 23, 2015
@rfodge
rfodge commented Oct 23, 2015

Why did you close this issue, it wasn't resolved yet? we still dont know how or which chromeOptions to use. I still would like to know which options to use for notifications, if one exists.

@rfodge
rfodge commented Oct 23, 2015

So I found the prefs options here: http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/pref_names.cc?view=markup

But i'm not sure what the value is i am supposed to use for the option? I tried this but it still doesn't work:
image

@sjelin
Contributor
sjelin commented Oct 23, 2015

I closed the issue because GitHub issues are only for feature requests/bug reports/things that will induce use to change the codebase. Since these feature exists, it's more of a support question, which is better asked on stack overflow. Probably if you ask there there's a much better chance of someone knowing which option to use.

@jlin412
jlin412 commented Oct 23, 2015

@sjelin and @rfodge I got it to work with

prefs: {'profile.managed_default_content_settings.geolocation': 1}

@rfodge the value should 0, 1, 2, 3 ...
Give it shot.

@rfodge
rfodge commented Oct 23, 2015

Yes, thank you! I got it to work with using 1 as well.

@tessythomas

Could anyone please suggest how to allow or block location using the popup in protractor?

@facupedrazzini

Hi, thanks for the info @rfodge ! but I need to allow navigator.webkitPersistentStorage and I can't find the pref name here:
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/pref_names.cc

someone know it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment