How to handle GeoLocation Pop Up for the browsers using Selenium Webdriver capabilites

721 views
Skip to first unread message

Display Name

unread,
Jan 11, 2016, 7:12:33 AM1/11/16
to Selenium Users
I want my browser to launch without geolocation popup. I don't want to set a new firefox/chrome profile by always enabling this field and then launch that profile.

Is there any way by which I can directly set some "Key" "Value" pairs of the browser using capabilities?

Anand Somani

unread,
Jan 11, 2016, 8:40:40 AM1/11/16
to seleniu...@googlegroups.com
Open firefox and hit about:config URL. You will get all keys and values.

1. Let's first start by creating the FirefoxProfile object:
FirefoxProfile fp= new FirefoxProfile();

2. Now we will set the preference by using the below method:
fp.setPreference("browser.startup.homepage","http://www.google.com");

3. To get the profile to be used, we need to pass it in to the driver. To do this, we need
to do the following:
driver = new FirefoxDriver(fp);

OR 

Refer this page and create firefox profile https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles then use below code in script.

System.setProperty("webdriver.firefox.profile", "newprofilename");

Thanks & Regards,
Anand Somani
Blogs: http://seleniumtestingguide.blogspot.in/


On 11 January 2016 at 17:42, Display Name <cromaselen...@gmail.com> wrote:
I want my browser to launch without geolocation popup. I don't want to set a new firefox/chrome profile by always enabling this field and then launch that profile.

Is there any way by which I can directly set some "Key" "Value" pairs of the browser using capabilities?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d8067ba9-0541-4592-91c7-d30b6044b8be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rajeshwari H

unread,
Apr 8, 2016, 12:00:20 AM4/8/16
to Selenium Users

Hi Anand Somani,

How can we do the same in chrome and  IE browser.

Thanks,
Rajeshwari
Reply all
Reply to author
Forward
0 new messages