Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: a value is required for '--proxy ' but none was supplied with ProxyType.DIRECT #14162

Closed
Jobvdb opened this issue Jun 20, 2024 · 10 comments

Comments

@Jobvdb
Copy link

Jobvdb commented Jun 20, 2024

What happened?

Im developing a test automation app that uses Selenium and with upgrading from 4.18.1 to 4.21.0, I got this error: Unable to obtain: chromedriver, error Command failed with code: 2, executed: [--browser, chrome, --proxy, --language-binding, java, --output, json] error: a value is required for '--proxy ' but none was supplied For more information, try '--help'.

In the example below, I'm using ProxyType.DIRECT, but any type will trigger this behavior (including AUTODETECT)

How can we reproduce the issue?

@Test
    void withProxy() {
        org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
        proxy.setProxyType(org.openqa.selenium.Proxy.ProxyType.DIRECT);
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.setProxy(proxy);
        new ChromeDriver(chromeOptions);
    }

Relevant log output

org.openqa.selenium.remote.NoSuchDriverException: Unable to obtain: chromedriver, error Command failed with code: 2, executed: [--browser, chrome, --proxy, --language-binding, java, --output, json]
error: a value is required for '--proxy <PROXY>' but none was supplied

For more information, try '--help'.

        at org.openqa.selenium.remote.service.DriverFinder.getBinaryPaths(DriverFinder.java:121)
        at org.openqa.selenium.remote.service.DriverFinder.getDriverPath(DriverFinder.java:55)
        at org.openqa.selenium.chrome.ChromeDriver.generateExecutor(ChromeDriver.java:99)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:83)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72)
        at nl.testautomaat.test.driver.web.RemoteTest.withProxy(RemoteTest.java:27)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: org.openqa.selenium.WebDriverException: Command failed with code: 2, executed: [--browser, chrome, --proxy, --language-binding, java, --output, json]
error: a value is required for '--proxy <PROXY>' but none was supplied

For more information, try '--help'.

        at org.openqa.selenium.manager.SeleniumManager.runCommand(SeleniumManager.java:169)
        at org.openqa.selenium.manager.SeleniumManager.getBinaryPaths(SeleniumManager.java:244)
        at org.openqa.selenium.remote.service.DriverFinder.getBinaryPaths(DriverFinder.java:102)
        ... 9 more
Caused by: org.openqa.selenium.json.JsonException: Unable to parse: error: a value is required for '--proxy <PROXY>' but none was supplied

For more information, try '--help'.

        at org.openqa.selenium.json.Json.toType(Json.java:169)
        at org.openqa.selenium.json.Json.toType(Json.java:152)
        at org.openqa.selenium.manager.SeleniumManager.runCommand(SeleniumManager.java:154)
        ... 11 more
Caused by: org.openqa.selenium.json.JsonException: Unable to determine type from: e. Last 1 characters read: e, next 107 characters to read: rror: a value is required for '--proxy <PROXY>' but none was supplied

For more information, try '--help'.

Build info: version: '4.21.0', revision: '79ed462ef4'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.0', java.version: '21.0.1'
Driver info: driver.version: ChromeDriver
        at org.openqa.selenium.json.JsonInput.peek(JsonInput.java:166)
        at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:167)
        at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:146)
        at org.openqa.selenium.json.Json.toType(Json.java:206)
        at org.openqa.selenium.json.Json.toType(Json.java:167)
        ... 13 more

Operating System

macOS

Selenium version

Java 4.21.0

What are the browser(s) and version(s) where you see this issue?

Chrome 126.0.6478.62 (Official build) (arm64)

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 126.0.6478.62

Are you using Selenium Grid?

No response

@Jobvdb Jobvdb changed the title [🐛 Bug]: [🐛 Bug]: a value is required for '--proxy ' but none was supplied with Proxy.DIRECT Jun 20, 2024
@Jobvdb Jobvdb changed the title [🐛 Bug]: a value is required for '--proxy ' but none was supplied with Proxy.DIRECT [🐛 Bug]: a value is required for '--proxy ' but none was supplied with ProxyType.DIRECT Jun 20, 2024
Copy link

@Jobvdb, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

Thanks for reporting, the bindings need to pass along the proxy information to Selenium Manager only when things need to be routed through a host instead of always,

@titusfortner titusfortner added this to the 4.22 milestone Jun 20, 2024
@diemol diemol modified the milestones: 4.22, 4.23 Jun 21, 2024
@Jobvdb
Copy link
Author

Jobvdb commented Jun 24, 2024

Thanks for picking this up! In the meantime, is there a work-around for this, except for not using the proxy setting?

@titusfortner
Copy link
Member

Looks like it was added back in 4.9, which is too far back to make sense to downgrade versions.

Can either remove proxy or manage the drivers yourself for now.

@Jobvdb
Copy link
Author

Jobvdb commented Jun 24, 2024

Alright, that was what I was going for, except I’m currently running 4.18.1 and it is working on that version. Not sure if that helps?

@titusfortner
Copy link
Member

Oh, that's interesting. Can you turn on debugging and see what's different between the two?
https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/

@Jobvdb
Copy link
Author

Jobvdb commented Jun 25, 2024

Added Logger, but it seems to not log anything at all, before throwing the NoSuchDriverException. Maybe I'm doing it wrong? Here is my updated code:

@Test
    void withProxy() {
        Logger logger = Logger.getLogger("Proxy logger");
        logger.setLevel(Level.FINEST);
                Arrays.stream(logger.getHandlers()).forEach(handler -> {
            handler.setLevel(Level.FINEST);
        });

        org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
        proxy.setProxyType(org.openqa.selenium.Proxy.ProxyType.DIRECT);
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.setProxy(proxy);
    }

@diemol
Copy link
Member

diemol commented Jun 26, 2024

You can try this tomorrow after the Nightly build has been generated. This will be also part of the 4.23 release.

@Jobvdb
Copy link
Author

Jobvdb commented Jun 27, 2024

Perfect thanks! Tested and it works with the 4.23.0-SNAPSHOT version

Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 27, 2024
sandeepsuryaprasad pushed a commit to sandeepsuryaprasad/selenium that referenced this issue Oct 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

No branches or pull requests

3 participants