Saturday 10 September 2016

How to uncheck proxy server settings in chrome browser using Selenium WebDriver

If you have read my past post, you might know that I follow a lot of forums to understand what type of issues are faced by the community. This helps me to broaden my knowledge. A couple of days ago, I stumbled upon this question on such forum on Facebook.


Question was-

How to uncheck proxy server settings in chrome browser using selenium Code ?” with Below image.




Proxy Server Setting for Browser
Proxy Server Setting for Browser


That was a really interesting question, thanks for this question ‎Roby Chauhan.


Defining problem statement:-

Uncheck proxy setting while invoking Chrome browser using Selenium WebDriver.



Understanding Problem Statement:-
I first tried to solve this question manually and realised once again that proxy setting that you applied in one browser are not just that browser specific but it OS specific.


That means if you set proxy in one browser it is applicable to all browser. If you set the wrong proxy in one browser you would not able to connect to the internet using any browser. Refer image below for more understanding. The image is taken from Chrome support group for education and help.


Order of Precedence for Chrome Policies:
Order of Precedence for Chrome Policies


So basically we are talking about this red box, where we doing some setting which we need to overcome while invoking chrome using Selenium WebDriver.


Solution:-
After a lot of search on Google, I found a solution somewhere on the internet, we need to use Capabilities & ChromeOptions of chrome. To be specific below option:-


options.addArguments("--no-proxy-server");


Please check working code snippet below:-



This is all for now.
Cheers!!

No comments:

Post a Comment