How to handle chrome's blahblah wants to: Know your location. Block/Allow

1,379 views
Skip to first unread message

Austin France

unread,
Oct 19, 2015, 10:22:37 AM10/19/15
to Selenium Users


This as recently started appearing in my tests.  Previously I believe it was being suppressed by the --test-ui command line option but that would appear to no longer the case.  It isn't actually stopping the scripts from running  (WebDriver from functioning) but I would like to dismiss it/prevent it if possible.



sunny sachdeva

unread,
Oct 20, 2015, 12:00:28 AM10/20/15
to Selenium Users
It is not an HTML pop up which Selenium can handle. The other way which I can suggest is to go for Java Robot OR AutoIT or Sikuli.


Thanks
Sunny S

Prv 小飼慎一

unread,
Oct 20, 2015, 2:49:22 AM10/20/15
to Selenium Users
Same problem occured to my project.

2015年10月19日月曜日 23時22分37秒 UTC+9 Austin France:

Austin France

unread,
Oct 20, 2015, 4:57:51 AM10/20/15
to seleniu...@googlegroups.com
Ah, so I could add something to my scripts (written using https://github.com/redskyit/ScriptDriver) that spawned something like autoit (or in my case probably applescript) to dismiss this dialog.  Sounds like a plan!

Regards
Austin



--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/pJEchbrNDvs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c91d3a6d-3a07-434a-b420-bbe30ea9c25d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Harish Krishnan

unread,
Oct 20, 2015, 4:59:04 AM10/20/15
to seleniu...@googlegroups.com
Hi Team,

Just set the latitude and  longitude which you prefer . its working fine . same scenario for me.


JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("window.navigator.geolocation.getCurrentPosition=function(success){"+
                "var position = {\"coords\" : {\"latitude\": \"555\",\"longitude\": \"999\"}};"+
                "success(position);}");

System.out.println(js.executeScript("var positionStr=\"\";"+
            "window.navigator.geolocation.getCurrentPosition(function(pos){positionStr=pos.coords.latitude+\":\"+pos.coords.longitude});"+
            "return positionStr;"));

Thanks
Harikrishnan

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

Austin France

unread,
Oct 20, 2015, 5:01:41 AM10/20/15
to seleniu...@googlegroups.com
Thank you, another useful approach.

Regards
Austin



Krishnan Mahadevan

unread,
Oct 20, 2015, 5:17:48 AM10/20/15
to Selenium Users
Have you explored all the command line switches that are available with Chrome ? http://peter.sh/experiments/chromium-command-line-switches/

I did see one such flag which you might want to leverage and see if that helps : http://peter.sh/experiments/chromium-command-line-switches/#test-type

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Austin France

unread,
Oct 20, 2015, 5:28:24 AM10/20/15
to Selenium Users
Sorry, the --test-ui mentioned in the OP was a typo, it should have said --test-type=ui yes I have been using that to suppress prompts but the location prompt would seem to be no longer suppressed by it.  

I am using the following options at present

browser option "--unlimited-storage"

browser option "--disable-extensions"

browser option "--test-type=ui"


An --allow-geolocation option would have been ideal.

Krishnan Mahadevan

unread,
Oct 20, 2015, 5:34:46 AM10/20/15
to Selenium Users
Have you done the following :

1. Spawn Chrome manually by passing in that flag and see Chrome responds properly to that flag ?
2. Check if the flag that you are sending via your test code, reaches ChromeDriver by turning on the ChromeDriver logs ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Austin France

unread,
Oct 20, 2015, 5:45:28 AM10/20/15
to seleniu...@googlegroups.com

Taken from ps(1) made a script, and ran it, still prompted.  --test-type=browser does the same.  It is the latest version of chrome that has triggered this, previously it would not prompt using these options.

#!/bin/bash

"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
    --disable-background-networking \
    --disable-client-side-phishing-detection \
    --disable-component-update \
    --disable-default-apps \
    --disable-extensions \
    --disable-hang-monitor \
    --disable-prompt-on-repost \
    --disable-sync \
    --disable-web-resources \
    --enable-logging \
    --full-memory-crash-report \
    --ignore-certificate-errors \
    --load-component-extension=/var/folders/7r/_3bt2vjs2lb7ql4tg98983x00000gn/T/.org.chromium.Chromium.ITY8EQ/internal \
    --logging-level=1 \
    --metrics-recording-only \
    --no-first-run \
    --password-store=basic \
    --remote-debugging-port=12071 \
    --safebrowsing-disable-auto-update \
    --safebrowsing-disable-download-protection \
    --test-type=ui \
    --unlimited-storage \
    --use-mock-keychain \
    --user-data-dir=/var/folders/7r/_3bt2vjs2lb7ql4tg98983x00000gn/T/.org.chromium.Chromium.ZbALEB \
    http://localhost/~adf/RMC2/trunk/client/


Regards
Austin



Krishnan Mahadevan

unread,
Oct 20, 2015, 5:49:23 AM10/20/15
to Selenium Users
You either stumbled into a Chrome Browser (or) maybe the browser has changed functionality wherein it honors some other flag instead of this one. 
In either case, I think you might want to the chrome browser forum and see if something springs up over there.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply all
Reply to author
Forward
0 new messages