Need help with proxy settings in "open browser" keyword

2,612 views
Skip to first unread message

Sachin Nikam

unread,
Aug 15, 2014, 9:11:23 AM8/15/14
to robotframe...@googlegroups.com
Hi All,

I need to pass proxy details while opening the browser. When I configure the proxy in the browser and open browser it works correctly. But using open browser keyword from the test it's not working. To pass proxy details in the test I am using desired_capabilities to the open browser keyword as follows:

open browser    http://www.google.com    ff    desired_capabilities=proxyType:manual,httpProxy:localhost:9091


Browser opens correctly but somehow proxy settings are not getting applied.

I have run test in debug mode as well, below is the log from the debug file:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20140815 18:24:50.058 - INFO - +---- START KW: Selenium2Library.Open Browser [ http://www.google.com | ff | desired_capabilities=proxyType:manual,httpProxy:localhost:9091 ]
20140815 18:24:50.058 - INFO - Opening browser 'ff' to base url 'http://www.google.com'
20140815 18:25:00.162 - DEBUG - Opened browser with session id 78ab7722-281d-4a48-b66c-05505e8bd1fc
20140815 18:25:00.163 - INFO - +---- END KW: Selenium2Library.Open Browser (10104)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Not sure if above mentioned is the correct way to pass proxy details and if correct why proxy settings are not getting applied.

Thanks & Regards,
Sachin Nikam

Kevin O.

unread,
Aug 15, 2014, 11:35:36 AM8/15/14
to robotframe...@googlegroups.com
From the keyword documentation:
 If you specify a value for remote you can also specify 'desired_capabilities' which is a string in the form key1:val1,key2:val2 that will be used to specify desired_capabilities to the remote server. 

In other words, Open Browser does not process desired_capabilities for local webdrivers.

There are two solutions to this:
2) use Create Webdriver to pass desired_capabilities to the init of the IE webdriver

Kevin

Sachin Nikam

unread,
Aug 15, 2014, 2:56:21 PM8/15/14
to robotframe...@googlegroups.com
Hey Kevin,

Thanks for your help.

I wanted to capture all http requests made from the browser. So I am using browsermobproxy as a proxy. I am able to capture http request from the Firefox browser by manually configuring proxy setting. However when I am trying to do the same using open browser keyword it's failing. As per solution provided by you works for ie browser. Will it work for the Firefox browser as well.

Again thanks for your help.

Kevin O.

unread,
Aug 15, 2014, 8:08:52 PM8/15/14
to robotframe...@googlegroups.com
Yes, I think changing the default capabilities will work for Firefox, but I cannot remember if I ever tried that. If not, the documentation for Create Webdriver has an example for that. For Chrome, changing the default capabilities won't work. You have to use Create Webdriver to pass in proxy settings for Chrome.

Sachin Nikam

unread,
Aug 16, 2014, 6:12:28 AM8/16/14
to robotframe...@googlegroups.com
Hi Kevin,

Thanks for your help.

Issue has been resolved now. I am able to use use open browser with proxy settings :)

Ss Raghavan

unread,
Aug 16, 2014, 7:35:48 AM8/16/14
to robotframe...@googlegroups.com
One good way is to have ff profile created with your custom prxy added to it. Then use the below command like this

Library. operating system
Library selenium library

Testcase
Try proxy
Set environment variable localhost 127.0.01
Open browser. ${URL} Browser=ff. ff_profile_dir=custom-profile-path

Note: sorry for the typo , but this works this is how use it for my project which uses special proxy setting

Sachin Nikam

unread,
Aug 16, 2014, 10:34:28 PM8/16/14
to robotframe...@googlegroups.com
Hi Raghavan,

Thanks for your help.

I'll give it a try.

Manish Verma

unread,
Sep 22, 2019, 2:42:18 PM9/22/19
to robotframework-users
Hi Sachin/Kevin,

sorry It is very old post. Is it possible for your to share the working code. I am developing robot selenium script where I want to open a firefox browser  with NoProxy.
Want firefox which is opened by script should not use system proxy.

open browser    http://www.google.com    ff    desired_capabilities=proxyType:direct.

Hi Kevin,

Could you please let me know how can we achieve this.

Thanks
Manish
Reply all
Reply to author
Forward
0 new messages