Open GoogleCodeExporter opened 9 years ago
Android version is 4.3 and device chrome version is 39.0.2171.93, chromedriver
version is 2.13
Original comment by surat....@gmail.com
on 11 Jan 2015 at 9:38
Original comment by andrewch...@chromium.org
on 21 Jan 2015 at 12:01
do prefs this way
Map<String, Object> prefs = new Hashtable<String, Object>();
prefs.put("profile.default_content_settings.geolocation", 2);
//
ChromeOptions chromeOptions = new ChromeOptions();
//chromeOptions.setExperimentalOption("androidPackage", "com.android.chrome");
chromeOptions.setExperimentalOption("prefs", prefs);
//
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
capabilities.setCapability("locationContextEnabled", true);
Original comment by andrewch...@chromium.org
on 21 Jan 2015 at 11:27
With the proposed way, the test runs on the desktop chrome browser and it does
not go to my connected Android device. I get "error : unrecognized chrome
option: prefs." if I add this line of code.
chromeOptions.setExperimentalOption("androidPackage", "com.android.chrome");
Original comment by surat....@gmail.com
on 22 Jan 2015 at 8:46
following work for me on emulator
Map<String, Object> prefs = new Hashtable<String, Object>();
prefs.put("profile.default_content_settings.geolocation", 2);
Map<String, Object> chromeOptions = new HashMap<String, Object>();
//chromeOptions.setExperimentalOption("androidPackage", "com.android.chrome");
chromeOptions.put("androidPackage", "com.android.browser");
chromeOptions.put("androidActivity", "com.android.browser.BrowserActivity");
chromeOptions.put("androidDeviceSerial", "emulator-5554");
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
capabilities.setCapability("locationContextEnabled", true);
//
capabilities.setCapability("prefs", prefs);
Original comment by andrewch...@chromium.org
on 26 Jan 2015 at 11:11
Hi Andrew, I want to invoke com.android.chrome and not com.android.browser like
in your example. Basically, I want to invoke chrome om my real device and then
go to "http://www.baidu.com". There, I don't want to see the location prompt.
So, I modified the code a bit but still that prefs is not applied, I still see
the location prompt.
Map<String, Object> prefs = new Hashtable<String, Object>();
prefs.put("profile.default_content_settings.geolocation", 2);
Map<String, Object> chromeOptions = new HashMap<String, Object>();
chromeOptions.put("androidPackage", "com.android.chrome");
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
capabilities.setCapability("locationContextEnabled", true);
capabilities.setCapability("prefs", prefs);
driver= new RemoteWebDriver(new URL("http://127.0.0.1:9515"), capabilities);
Original comment by surat....@gmail.com
on 27 Jan 2015 at 6:35
Hi,
1. you would like to invoke chrome browser in a android device?
2. open http://www.baidu.com can not tell what is location prompt.
Original comment by andrewch...@chromium.org
on 27 Jan 2015 at 6:33
Sorry, if I confused.
1. I am able to launch chrome on my Android device with the code snippet I
shared following your suggestion. Thanks. - No issues here.
2. Now, I want chrome to suppress the location prompt in Android device. I
thought of three options-
a. Use command line argument for chromedriver.exe - I could not figure out a suitable option or argument to do this.
b. Use chromeoptions or capability in the code to control this prompt (http://peter.sh/experiments/chromium-command-line-switches/) - I tried the options you suggested with prefs but not working. I still get the location prompt.
c. Issue 138 had one idea which I was exploring to be able to use for Android chrome but is not working.
Is it not possible to suppress the location prompt by chrome on Android at all ?
Original comment by surat....@gmail.com
on 27 Jan 2015 at 7:16
1. can you send(attach) me a screen shot of suppressing the location prompt in
Android device
2. this won't be chromedriver.exe argument, it will be chrome switch. Once I
understand , we will figure out
Original comment by andrewch...@chromium.org
on 27 Jan 2015 at 7:50
Attached is the screenshot. The screenshot shows the location prompt which I am
trying to suppress/dismiss but unable to.
Original comment by surat....@gmail.com
on 28 Jan 2015 at 2:58
Attachments:
you mean the URL box http://www.baidu.com?
Original comment by andrewch...@chromium.org
on 28 Jan 2015 at 6:23
I want to suppress/dismiss the prompt which says "http://www.baidul.com wants
to use your device's location." prompt. These prompts block most of the browser
window blocking further execution of my script.
Original comment by surat....@gmail.com
on 28 Jan 2015 at 9:11
you want to turn off location sharing
1. --enable-strict-powerful-feature-restrictions ⊗ Blocks insecure usage of
number of powerful features (geolocation, for example) that we haven't yet
deprecated for the web at large
2. turn off manually - https://support.google.com/chrome/answer/142065?hl=en
Original comment by andrewch...@chromium.org
on 28 Jan 2015 at 11:02
Thanks for the suggestion.
1. I am using below code which suppresses the translate prompt but still does
not suppress the location prompt (Please refer to my earlier screenshot).
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("androidPackage", "com.android.chrome");
chromeOptions.addArguments("--enable-strict-powerful-feature-restrictions");
chromeOptions.addArguments("--disable-translate");
capabilities.setCapability("locationContextEnabled", true);
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
driver = new RemoteWebDriver(new URL("http://127.0.0.1:9515"), capabilities);
2. Using similar option as per your suggestion (manual turn off), I am able to
turn off. But unable to turn on for all sites. There is not such option to turn
on in Android.
Original comment by surat....@gmail.com
on 31 Jan 2015 at 1:06
1. this is new to me, need some research.
2. you don't want to turn off for all sites. only the site you S/W test on?
Original comment by andrewch...@chromium.org
on 31 Jan 2015 at 1:20
Thanks for looking into this. I will wait for your research findings.
Original comment by surat....@gmail.com
on 31 Jan 2015 at 1:48
[deleted comment]
Strange, why it does not work on the same way on my Android 4.3 device. I am
using Sony Xperia M C1904 model. It still prompts location.
Original comment by surat....@gmail.com
on 2 Feb 2015 at 8:47
[deleted comment]
[deleted comment]
tried Sansumg S4, and it will show up. Nexus 7 does not show up.(may have
other reason)
need more research.
Original comment by andrewch...@chromium.org
on 2 Feb 2015 at 10:33
Original comment by andrewch...@chromium.org
on 3 Feb 2015 at 6:49
Original comment by samu...@chromium.org
on 21 Feb 2015 at 12:19
Original issue reported on code.google.com by
surat....@gmail.com
on 11 Jan 2015 at 9:23