jmeter-plugins-webdriver Manual Proxy Configuration Errors

10 views
Skip to first unread message

George Li

unread,
Jul 1, 2024, 3:45:41 PM (3 days ago) Jul 1
to jmeter-plugins
I'm trying to use the jmeter-plugins-webdriver plugin v4.13.0.0 with a manual proxy configuration but to keep running into this error:

```log
2024-06-28 18:11:11,735 ERROR o.a.j.t.JMeterThread: Error calling threadStarted
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: invalid argument: entry 0 of 'firstMatch' is invalid
from invalid argument: cannot parse capability: proxy
from invalid argument: 'socksVersion' must be between 0 and 255
```

Looking at the source code, the plugin is not setting the socksVersion value (the config element is not collecting this value):
``` java
public Proxy getManualProxy(ProxyHostPort httpProxy, ProxyHostPort httpsProxy, ProxyHostPort ftpProxy, ProxyHostPort socksProxy, String noProxy) {
        return new Proxy()
            .setProxyType(Proxy.ProxyType.MANUAL)
            .setHttpProxy(httpProxy.toUnifiedForm())
            .setSslProxy(httpsProxy.toUnifiedForm())
            .setFtpProxy(ftpProxy.toUnifiedForm())
            .setSocksProxy(socksProxy.toUnifiedForm())
            .setNoProxy(noProxy);
    }
```

And in the underlying Selenium package the socksVersion default value is null:

```java
private ProxyType proxyType = ProxyType.UNSPECIFIED;
  private boolean autodetect = false;
  private String ftpProxy;
  private String httpProxy;
  private String noProxy;
  private String sslProxy;
  private String socksProxy;
  private Integer socksVersion;
  private String socksUsername;
  private String socksPassword;
  private String proxyAutoconfigUrl;
```

A somewhat related issue is that there's no way to selectively set proxies when going the manual route - it seems to be an all or nothing approach:

```java
public Proxy createProxy() {
switch (getProxyType()) {
case PROXY_PAC:
return proxyFactory.getConfigUrlProxy(getProxyPacUrl());
case DIRECT:
return proxyFactory.getDirectProxy();
case AUTO_DETECT:
return proxyFactory.getAutodetectProxy();
case MANUAL:
if (isUseHttpSettingsForAllProtocols()) {
ProxyHostPort proxy = new ProxyHostPort(getHttpHost(), getHttpPort());
return proxyFactory.getManualProxy(proxy, proxy, proxy, proxy, getNoProxyHost());
}
ProxyHostPort http = new ProxyHostPort(getHttpHost(), getHttpPort());
ProxyHostPort https = new ProxyHostPort(getHttpsHost(), getHttpsPort());
ProxyHostPort ftp = new ProxyHostPort(getFtpHost(), getFtpPort());
ProxyHostPort socks = new ProxyHostPort(getSocksHost(), getSocksPort());
return proxyFactory.getManualProxy(http, https, ftp, socks, getNoProxyHost());
default:
return proxyFactory.getSystemProxy();
}
}
```



Examples of why I would want this would be not setting the FTP proxy for Firefox/Gecko driver because: "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Since Firefox 90 'ftpProxy' is no longer supported"
Reply all
Reply to author
Forward
0 new messages