Setting a proxy via DesiredCapabilities in RemoteWebDriver

9,350 views
Skip to first unread message

Neil Halelamien

unread,
Jun 23, 2011, 2:27:11 PM6/23/11
to webdriver
I've been having difficulty using DesiredCapabilities to set a proxy
for webdriver to use. It works just fine when using FirefoxDriver, but
gives me a "Proxy autodetect is incompatible with manual settings"
when I try it with RemoteWebDriver. This is rather perplexing since
I'm not explicitly setting proxy autodetect anywhere, but just trying
to use manual settings. I'm using Selenium 2.0rc2. Although I'm using
RemoteWebDriver, I'm actually using it with a selenium server sitting
on my local machine.

Here's the code snippet that works for me:

<<
Proxy proxy = new Proxy();
proxy.setProxyType(ProxyType.MANUAL);
proxy.setHttpProxy(PROXY_ADDRESS);
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = null;
//driver = new RemoteWebDriver(new URL(SELENIUM_SERVER_ADDRESS),
dc); // RemoteWebDriver initialization
driver = new FirefoxDriver(dc); // FirefoxDriver initialization
>>

However, commenting out the FirefoxDriver initialization line and
uncommenting the RemoteWebDriver line, I get the following:

Exception in thread "main" org.openqa.selenium.WebDriverException:
Proxy autodetect is incompatible with manual settings
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1',
java.version: '1.6.0_24'
Driver info: driver.version: SampleWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:
131)
at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:
105)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
409)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:
103)
at
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:
86)
at
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:
94)
at org.supermind.webdriver.SampleWebDriver.fetch(SampleWebDriver.java:
56)
at org.supermind.webdriver.SampleWebDriver.main(SampleWebDriver.java:
91)
Caused by: java.lang.IllegalStateException: Proxy autodetect is
incompatible with manual settings
at org.openqa.selenium.Proxy.verifyProxyTypeCompatilibily(Proxy.java:
153)
at org.openqa.selenium.Proxy.setProxyAutoconfigUrl(Proxy.java:134)
at org.openqa.selenium.Proxy.<init>(Proxy.java:57)
at
org.openqa.selenium.browserlaunchers.Proxies.extractProxy(Proxies.java:
89)
at
org.openqa.selenium.firefox.FirefoxDriver.extractProfile(FirefoxDriver.java:
106)
at
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:
86)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(null)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(null)
at java.lang.reflect.Constructor.newInstance(null)
at
org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:
87)
at
org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:
81)
at org.openqa.selenium.remote.server.DefaultSession
$BrowserCreator.call(DefaultSession.java:151)
at org.openqa.selenium.remote.server.DefaultSession
$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(null)
at java.util.concurrent.FutureTask.run(null)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(null)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(null)
at java.lang.Thread.run(null)

Any ideas about what could be the problem would be greatly
appreciated. Thanks!

Luke Inman-Semerau

unread,
Jun 27, 2011, 12:55:05 PM6/27/11
to webd...@googlegroups.com
You need to add the line:

proxy.setAutodetect(false);


--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.


Neil Halelamien

unread,
Jun 27, 2011, 1:53:20 PM6/27/11
to webdriver
I've tried adding a setAutodetect(false), but unfortunately still get
the same "Proxy autodetect is incompatible with manual settings" error
with the following code:

Proxy proxy = new Proxy();
proxy.setAutodetect(false);
proxy.setProxyType(ProxyType.MANUAL);
proxy.setHttpProxy(PROXY_ADDRESS);
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver;
driver = new RemoteWebDriver(new URL("http://" + LOCAL_HOST + ":
4444/wd/hub"),dc);
//driver = new FirefoxDriver(dc);

On Jun 27, 9:55 am, Luke Inman-Semerau <luke.seme...@gmail.com> wrote:
> You need to add the line:
>
> proxy.setAutodetect(false);
>
> On Thu, Jun 23, 2011 at 11:27 AM, Neil Halelamien <neuronexmach...@gmail.com

Luke Inman-Semerau

unread,
Jun 27, 2011, 2:50:27 PM6/27/11
to webd...@googlegroups.com
Can you try setting the FirefoxProfile instead of the proxy preference in the desiredCapabilities?

change this line:
dc.setCapability(CapabilityType.PROXY, proxy);

to:

FirefoxProfile fp = new FirefoxProfile();
fp.setProxyPreferences(proxy);
dc.setCapability(FirefoxDriver.PROFILE, fp);

Neil Halelamien

unread,
Jun 27, 2011, 5:54:42 PM6/27/11
to webdriver
Interesting, that actually works perfectly, thanks. Is there a
solution which would also work with other browsers, or is Firefox the
only one which supports setting a proxy?

On Jun 27, 11:50 am, Luke Inman-Semerau <luke.seme...@gmail.com>
wrote:
> Can you try setting the FirefoxProfile instead of the proxy preference in
> the desiredCapabilities?
>
> change this line:
> dc.setCapability(CapabilityType.PROXY, proxy);
>
> to:
>
> FirefoxProfile fp = new FirefoxProfile();
> fp.setProxyPreferences(proxy);
> dc.setCapability(FirefoxDriver.PROFILE, fp);
>
> On Mon, Jun 27, 2011 at 10:53 AM, Neil Halelamien <neuronexmach...@gmail.com

Luke Inman-Semerau

unread,
Jun 27, 2011, 6:12:50 PM6/27/11
to webd...@googlegroups.com
Firefox is the only one with profiles, IE is bound to whatever configuration is on that machine (so you only need to set it once per box). With the others (Chrome, Safari, Opera) there should be a way to pass in the proxy configuration but I don't know it / haven't had to do that yet ~ unless they work how IE works and the config is set per machine.

Neil Halelamien

unread,
Jun 27, 2011, 8:06:52 PM6/27/11
to webdriver
Got it, thanks.

On Jun 27, 3:12 pm, Luke Inman-Semerau <luke.seme...@gmail.com> wrote:
> Firefox is the only one with profiles, IE is bound to whatever configuration
> is on that machine (so you only need to set it once per box). With the
> others (Chrome, Safari, Opera) there should be a way to pass in the proxy
> configuration but I don't know it / haven't had to do that yet ~ unless they
> work how IE works and the config is set per machine.
>
> On Mon, Jun 27, 2011 at 2:54 PM, Neil Halelamien
> <neuronexmach...@gmail.com>wrote:

Simon Stewart

unread,
Jul 2, 2011, 2:39:18 PM7/2/11
to webd...@googlegroups.com
Your example should read:

Proxy proxy = new Proxy();

proxy.setHttpProxy(PROXY_ADDRESS);
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(CapabilityType.PROXY, proxy);

WebDriver driver = new FirefoxDriver(dc); // FirefoxDriver initialization

The "setHttpProxy" method will set the type appropriately. This should
also work with the IE driver too.

Simon

Krishnan M

unread,
Jul 7, 2011, 4:29:33 AM7/7/11
to webdriver
I have been having issues with RemoteWebDriver and proxy settings
especially when it involves IE.

Proxy proxy = new Proxy();
proxy.setProxyAutoconfigUrl(MYPROXY_PAC_URL_GOES_HERE);
DesiredCapabilities capability = new DesiredCapabilities();
capability.setBrowserName(DesiredCapabilities.internetExplorer().getBrowserName());
capability.setCapability(CapabilityType.PROXY, proxy);
RemoteWebDriver d = new RemoteWebDriver(new URL("http://localhost:4444/
wd/hub"), capability);
Selenium s = new WebDriverBackedSelenium(d, "http://www.google.com");

The line
RemoteWebDriver d = new RemoteWebDriver(new URL("http://localhost:4444/
wd/hub"), capability);

keeps giving me this error:
org.openqa.selenium.WebDriverException: Proxy autodetect is
incompatible with manual settings
Build info: version: '2.0rc3', revision: 'unknown', time: '2011-06-29
11:21:17'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
java.version: '1.6.0_20'
Driver info: driver.version: RemoteWebDriver

Following is how I am starting my local hub and a local webdriver node

start java -jar selenium-server-standalone-2.0rc3.jar -role hub
start java -jar selenium-server-standalone-2.0rc3.jar -role webdriver -
hub http://localhost:4444/grid/register -port 5556

Any pointers as to what am I missing here ?

Krishnan M



On Jul 2, 11:39 pm, Simon Stewart <simon.m.stew...@gmail.com> wrote:
> Your example should read:
>
>  Proxy proxy = new Proxy();
>  proxy.setHttpProxy(PROXY_ADDRESS);
>  DesiredCapabilities dc = DesiredCapabilities.firefox();
>  dc.setCapability(CapabilityType.PROXY, proxy);
>  WebDriver driver = new FirefoxDriver(dc); // FirefoxDriver initialization
>
> The "setHttpProxy" method will set the type appropriately. This should
> also work with the IE driver too.
>
> Simon
>
> On Mon, Jun 27, 2011 at 11:12 PM, Luke Inman-Semerau<luke.seme...@gmail.com> wrote:
> > Firefox is the only one with profiles, IE is bound to whatever configuration
> > is on that machine (so you only need to set it once per box). With the
> > others (Chrome, Safari, Opera) there should be a way to pass in the proxy
> > configuration but I don't know it / haven't had to do that yet ~ unless they
> > work how IE works and the config is set per machine.
>
> > On Mon, Jun 27, 2011 at 2:54 PM, Neil Halelamien <neuronexmach...@gmail.com>

Krishnan Mahadevan

unread,
Jul 11, 2011, 4:49:38 AM7/11/11
to webdriver
Any pointers on how to go about setting Proxy Server settings for IE by making use of RemoteWebDriver ?

I am trying out with the following code:


        Proxy proxy = new Proxy();
        proxy.setProxyAutoconfigUrl("http://mymachine/proxy.pac");       
        DesiredCapabilities capability = new DesiredCapabilities();
        capability.setBrowserName(DesiredCapabilities.internetExplorer().getBrowserName());       
        capability.setCapability(CapabilityType.ForSeleniumServer.PROXY_PAC, "http://mymachine/proxy.pac");
        RemoteWebDriver d = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);

        Selenium s = new WebDriverBackedSelenium(d, "http://www.google.com");
        s.open(MY_LAUNCH_URL);
        Thread.sleep(45000);
        s.close();


I see the following in the WebDriver node logs:

[TestRunner] Starting executor for test Default test with time out:2147483647 milliseconds.
14:15:13.950 INFO - Executing: [new session: {browserName=internet explorer, proxy_pac=http://mymachine/proxy.pac..., onlyProxySeleniumTraffic=true}] at URL: /session)
14:15:18.731 INFO - Executing: org.openqa.selenium.remote.server.handler.Status@be76c7 at URL: /status)


But I never manage to hit the proxy server (Whenever I hit a particular proxy server with a particular webURL, the functionality is such that it creates a log file for me. I dont see the log file getting created, and so am pretty sure I am not going through the Proxy server at all)


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

Simon Stewart

unread,
Jul 11, 2011, 5:36:55 AM7/11/11
to webd...@googlegroups.com
Use the org.openqa.selenium.Proxy class to configure the proxy
settings, then set it using the PROXY constant in the desired
capabilities. I've now added an FAQ about this:

http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_I_need_to_use_a_proxy._How_do_I_configure_that?

Simon

Krishnan Mahadevan

unread,
Jul 11, 2011, 6:18:15 AM7/11/11
to webd...@googlegroups.com
Simon,
Here are two specific scenarios: (Note : I am relying on the latest published selenium server standalone that I downloaded from selenium-server-standalone-2.0.0.jar)

PS : I intend to use RemoteWebDriver to kick off both local as well as remote runs. In the case of a local run, I spawn the hub programmatically and in case of remote runs I point to an already running hub. So using InternetExplorerDriver is not an option for me and I would have to rely on using only the RemoteWebDriver.

Scenario 1
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability(CapabilityType.PROXY, proxy);
//I am using this way of setting capabilities so that I can define much more generic WebDriver nodes and not
//have to provide a lot of other capabilities such as version, platform etc.
capability.setBrowserName(DesiredCapabilities.internetExplorer().getBrowserName());
InternetExplorerDriver d = new InternetExplorerDriver(capability);

On using the above format, I dont run into errors, but I dont seem to be hitting the proxy server either (Not sure what is going on there)

But when I use the following variant, I consistently hit errors.
Scenario 2
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability(CapabilityType.PROXY, proxy);
//I am using this way of setting capabilities so that I can define much more generic WebDriver nodes and not
//have to provide a lot of other capabilities such as version, platform etc.

capability.setBrowserName(DesiredCapabilities.internetExplorer().getBrowserName());

RemoteWebDriver d = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);

The line that is causing errors
RemoteWebDriver d = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);

StackTrace:

org.openqa.selenium.WebDriverException: Proxy autodetect is incompatible with manual settings
Build info: version: '2.0.0', revision: '12817', time: '2011-07-07 19:13:58'

System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_20'
Driver info: driver.version: RemoteWebDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:131)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:105)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:402)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:101)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:84)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:92)
    at com.paypal.AnotherDummyClass.runner(AnotherDummyClass.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)

Caused by: java.lang.IllegalStateException: Proxy autodetect is incompatible with manual settings
    at org.openqa.selenium.Proxy.verifyProxyTypeCompatilibily(Proxy.java:153)
    at org.openqa.selenium.Proxy.setFtpProxy(Proxy.java:101)
    at org.openqa.selenium.Proxy.<init>(Proxy.java:48)
    at org.openqa.selenium.browserlaunchers.Proxies.extractProxy(Proxies.java:89)
    at org.openqa.selenium.browserlaunchers.Proxies.newProxyPac(Proxies.java:102)
    at org.openqa.selenium.browserlaunchers.Proxies.makeProxyPAC(Proxies.java:63)
    at org.openqa.selenium.browserlaunchers.Proxies.makeProxyPAC(Proxies.java:55)
    at org.openqa.selenium.browserlaunchers.WindowsProxyManager.changeRegistrySettings(WindowsProxyManager.java:163)
    at org.openqa.selenium.ie.InternetExplorerDriver.prepareProxy(InternetExplorerDriver.java:191)
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:68)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(null)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(null)
    at java.lang.reflect.Constructor.newInstance(null)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:87)

    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:81)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:151)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)

    at java.util.concurrent.FutureTask$Sync.innerRun(null)
    at java.util.concurrent.FutureTask.run(null)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(null)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(null)
    at java.lang.Thread.run(null)




Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



Krishnan Mahadevan

unread,
Jul 11, 2011, 9:51:37 PM7/11/11
to webd...@googlegroups.com
Any pointers on this one folks ? I am like really stuck and can sure use some help.

I am basically looking for help on how to go about using RemoteWebDriver and do Proxy Server configurations.

PS: I know this works fine with the local webdrivers for all browsers, but I need to be able to use RemoteWebDriver only.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"


Derek Ekins

unread,
Jul 12, 2011, 11:02:43 AM7/12/11
to webd...@googlegroups.com
Hi Krishnan,

I've not looked into the code for this (recently anyway) but this error stands out for me:
Proxy autodetect is incompatible with manual settings

You are not setting it to be both autodetect and providing manual settings are you? Because that sounds like a nono.

Krishnan Mahadevan

unread,
Jul 12, 2011, 11:37:37 AM7/12/11
to webd...@googlegroups.com
Derek,

Following code snippet can recreate the error instantly for you.

Proxy proxy = new Proxy();
proxy.setProxyAutoconfigUrl("http://localhost:8080/proxy.pac");       
DesiredCapabilities capability = new DesiredCapabilities();
capability.setBrowserName(DesiredCapabilities.internetExplorer().getBrowserName());       
capability.setCapability(CapabilityType.PROXY, proxy);
RemoteWebDriver d = new RemoteWebDriver(new URL("http://myhub:4444/wd/hub"), capability);

Selenium s = new WebDriverBackedSelenium(d, "http://www.google.com");

As you can see, I am not explicitly setting the Proxy auto detection anywhere. But I still hit the same error.

I guess the line
proxy.setProxyAutoconfigUrl("http://localhost:8080/proxy.pac");
should automatically set the proxy type to "Proxy.ProxyType.PAC"

Quick question:
How should the WebDriver node connected to my hub be spawned as ?

I am currently using the following two lines to spawn the hub and the webdriver node.

java -jar selenium-server-standalone-2.0.0.jar -role hub
java -jar selenium-server-standalone-2.0.0.jar -role webdriver  -hub http://localhost:4444/grid/register -port 5556

Would appreciate if you could please help me with this, because when dealing with IE, I am now having to take the following **not so elegant** approach:
  • when spawning the webdriver node, add an explicit browser version to some weird value say "9999"
  • Manually configure the IE to make use of my proxy settings.
  • Then programmatically fudge the Browser version using capability.setVersion("9999")
because my hub would have Non Proxy IE browsers hooked on to it and Proxy Enabled IE browsers. Based on the user's need they would be routed to the appropriate browser flavors in the remote execution environment.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"


Derek Ekins

unread,
Jul 12, 2011, 11:56:30 AM7/12/11
to webd...@googlegroups.com
Looks like you are hitting:

  private void verifyProxyTypeCompatilibily(ProxyType compatibleProxy) {
    if (this.proxyType != ProxyType.UNSPECIFIED && this.proxyType != compatibleProxy) {
      throw new IllegalStateException("Proxy autodetect is incompatible with manual settings");
    }

But the code you posted looks fine to me. Are you sure nothing else is setting another type of proxy?
I don't have my hub configuration to hand so can't comment on that sorry..

Krishnan Mahadevan

unread,
Jul 12, 2011, 1:20:34 PM7/12/11
to webd...@googlegroups.com
Derek,
To the best of my knowledge that is all that I am trying to do. Any pointers on what could be wrong and how it could be fixed ?


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



Krishnan Mahadevan

unread,
Jul 13, 2011, 10:46:33 AM7/13/11
to webd...@googlegroups.com
Folks,

I did more playing around on this and I think I might have stumbled into a possible bug. Would appreciate if someone could please help take a look at this and confirm, so that I may try and explore alternatives on this.

The sample code that can help simulate this issue, the output that I got from running the code and the complete exception stacktrace is available at

https://gist.github.com/1080409

I still keep hitting "Proxy autodetect is incompatible with manual settings" even though I am setting a proxyconfiguration URL (so the expectation here is that the proxy type would be set to PAC)

Would appreciate if someone could please help take a look at this and advise.

Build info: version: '2.0.0', revision: '12817', time: '2011-07-07 19:14:12'

System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_20'
Browser : IE 7



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



Krishnan

unread,
Jul 14, 2011, 4:03:44 AM7/14/11
to webdriver
As a follow up on this discrepancy, I have logged this as an issue on
the Selenium bug tracking portal.

Issue : 2051 http://code.google.com/p/selenium/issues/detail?id=2051

Thanks and Regards
Krishnan Mahadevan


On Jul 13, 7:46 pm, Krishnan Mahadevan
<krishnan.mahadevan1...@gmail.com> wrote:
> Folks,
>
> I did more playing around on this and I think I might have stumbled into a
> possible bug. Would appreciate if someone could please help take a look at
> this and confirm, so that I may try and explore alternatives on this.
>
> The sample code that can help simulate this issue, the output that I got
> from running the code and the complete exception stacktrace is available at
>
> *https://gist.github.com/1080409*
>
> I still keep hitting *"Proxy autodetect is incompatible with manual
> settings"* even though I am setting a proxyconfiguration URL (so the
> expectation here is that the proxy type would be set to PAC)
>
> Would appreciate if someone could please help take a look at this and
> advise.
>
> *Build info: *version: '2.0.0', revision: '12817', time: '2011-07-07
> 19:14:12'
> *System info:* os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
> java.version: '1.6.0_20'
> *Browser :* IE 7
>
> Thanks & Regards
> Krishnan Mahadevan
>
> "All the desirable things in life are either illegal, expensive, fattening
> or in love with someone else!"
>
> On Tue, Jul 12, 2011 at 10:50 PM, Krishnan Mahadevan <
>
> krishnan.mahadevan1...@gmail.com> wrote:
> > Derek,
> > To the best of my knowledge that is all that I am trying to do. Any
> > pointers on what could be wrong and how it could be fixed ?
>
> > Thanks & Regards
> > Krishnan Mahadevan
>
> > "All the desirable things in life are either illegal, expensive, fattening
> > or in love with someone else!"
>
> > On Tue, Jul 12, 2011 at 9:26 PM, Derek Ekins <de...@spathi.com> wrote:
>
> >> Looks like you are hitting:
>
> >>   private void verifyProxyTypeCompatilibily(ProxyType compatibleProxy) {    if (this.proxyType != ProxyType.UNSPECIFIED && this.proxyType != compatibleProxy) {      throw new IllegalStateException("Proxy autodetect is incompatible with manual settings");    }
>
> >> But the code you posted looks fine to me. Are you sure nothing else is setting another type of proxy?
>
> >> I don't have my hub configuration to hand so can't comment on that sorry..
>
> >> On 12 July 2011 16:37, Krishnan Mahadevan <
> >> krishnan.mahadevan1...@gmail.com> wrote:
>
> >>> Derek,
>
> >>> Following code snippet can recreate the error instantly for you.
>
> >>> *Proxy proxy = new Proxy();
> >>> proxy.setProxyAutoconfigUrl("http://localhost:8080/proxy.pac");
> >>>  DesiredCapabilities capability = new DesiredCapabilities();
> >>> capability.setBrowserName(DesiredCapabilities.internetExplorer().getBrowserName());
>
> >>> capability.setCapability(CapabilityType.PROXY, proxy);
> >>> RemoteWebDriver d = new RemoteWebDriver(new URL("
> >>>http://myhub:4444/wd/hub"), capability);
>
> >>> Selenium s = new WebDriverBackedSelenium(d, "http://www.google.com");
>
> >>> *As you can see, I am not explicitly setting the Proxy auto detection
> >>> anywhere. But I still hit the same error.
>
> >>> I guess the line
> >>> *proxy.setProxyAutoconfigUrl("http://localhost:8080/proxy.pac");
> >>> *should automatically set the proxy type to *"Proxy.ProxyType.PAC"
> >>> *
> >>> Quick question:
> >>> How should the WebDriver node connected to my hub be spawned as ?
>
> >>> I am currently using the following two lines to spawn the hub and the
> >>> webdriver node.
>
> >>> *java -jar selenium-server-standalone-2.0.0.jar -role hub
> >>> java -jar selenium-server-standalone-2.0.0.jar -role webdriver  -hub
> >>>http://localhost:4444/grid/register-port 5556
> >>> *
> >>> Would appreciate if you could please help me with this, because when
> >>> dealing with IE, I am now having to take the following ***not so
> >>> elegant*** approach:
>
> >>>    - when spawning the webdriver node, add an explicit browser version
> >>>    to some weird value say "9999"
> >>>    - Manually configure the IE to make use of my proxy settings.
> >>>    - Then programmatically fudge the Browser version using
> >>>    capability.setVersion("9999")
>
> >>> because my hub would have Non Proxy IE browsers hooked on to it and Proxy
> >>> Enabled IE browsers. Based on the user's need they would be routed to the
> >>> appropriate browser flavors in the remote execution environment.
>
> >>> Thanks & Regards
> >>> Krishnan Mahadevan
>
> >>> "All the desirable things in life are either illegal, expensive,
> >>> fattening or in love with someone else!"
>
> >>> On Tue, Jul 12, 2011 at 8:32 PM, Derek Ekins <de...@spathi.com> wrote:
>
> >>>> Hi Krishnan,
>
> >>>> I've not looked into the code for this (recently anyway) but this error
> >>>> stands out for me:
> >>>> *
> >>>> Proxy autodetect is incompatible with manual settings
> >>>> *
>
> >>>> You are not setting it to be both autodetect and providing manual
> >>>> settings are you? Because that sounds like a nono.
>
> >>>>  On 12 July 2011 02:51, Krishnan Mahadevan <
> >>>> krishnan.mahadevan1...@gmail.com> wrote:
>
> >>>>>  Any pointers on this one folks ? I am like really stuck and can sure
> >>>>> use some help.
>
> >>>>> I am basically looking for help on how to go about using
> >>>>> RemoteWebDriver and do Proxy Server configurations.
>
> >>>>> PS: I know this works fine with the local webdrivers for all browsers,
> >>>>> but I need to be able to use RemoteWebDriver only.
>
> >>>>> Thanks & Regards
> >>>>> Krishnan Mahadevan
>
> >>>>> "All the desirable things in life are either illegal, expensive,
> >>>>> fattening or in love with someone else!"
>
> >>>>> On Mon, Jul 11, 2011 at 3:48 PM, Krishnan Mahadevan <
> >>>>> krishnan.mahadevan1...@gmail.com> wrote:
>
> >>>>>> Simon,
> >>>>>> Here are two specific scenarios: (Note : I am relying on the latest
> >>>>>> published selenium server standalone that I downloaded from
> >>>>>> selenium-server-standalone-2.0.0.jar)<http://selenium.googlecode.com/files/selenium-server-standalone-2.0.0...>
>
> >>>>>> *PS :* I intend to use RemoteWebDriver to kick off both local as well
> >>>>>> as remote runs. In the case of a local run, I spawn the hub programmatically
> >>>>>> and in case of remote runs I point to an already running hub. So using
> >>>>>> InternetExplorerDriver is not an option for me and I would have to rely on
> >>>>>> using only the RemoteWebDriver.
>
> >>>>>> *Scenario 1*
> >>>>>> *DesiredCapabilities capability = new DesiredCapabilities();
> >>>>>> capability.setCapability(CapabilityType.PROXY, proxy);
> >>>>>> //I am using this way of setting capabilities so that I can define
> >>>>>> much more generic WebDriver nodes and not
> >>>>>> //have to provide a lot of other capabilities such as version,
> >>>>>> platform etc.
>
> >>>>>> capability.setBrowserName(DesiredCapabilities.internetExplorer().getBrowserName());
> >>>>>> InternetExplorerDriver d = new InternetExplorerDriver(capability);
> >>>>>> *
> >>>>>> On using the above format, I dont run into errors, but I dont seem to
> >>>>>> be hitting the proxy server either (Not sure what is going on there)
>
> >>>>>> But when I use the following variant, I consistently hit errors.
> >>>>>> *Scenario 2*
> >>>>>> *DesiredCapabilities capability = new DesiredCapabilities();
> >>>>>> capability.setCapability(CapabilityType.PROXY, proxy);
> >>>>>> **//I am using this way of setting capabilities so that I can define
> >>>>>> much more generic WebDriver nodes and not
> >>>>>> //have to provide a lot of other capabilities such as version,
> >>>>>> platform etc.*
> >>>>>> *
>
> >>>>>> capability.setBrowserName(DesiredCapabilities.internetExplorer().getBrowserName());
> >>>>>> RemoteWebDriver d = new RemoteWebDriver(new URL("
> >>>>>>http://localhost:4444/wd/hub"), capability);
> >>>>>> *
> >>>>>> The line that is causing errors
> >>>>>> *
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages