-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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]: Selenium remote driver is giving error with proxy authentication #14176
Comments
@pvsharma, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
I'm not sure what you mean by it does not work in Java 11, but works in Java 8. Selenium no longer works with Java 8, so there are going to be more differences than just the Java version number. You have an advanced setup and I can see 3 places it might be getting caught up.
So you need to start with checking if the service provider is getting your request, and then work from there. Another thing off the bat, back sure you're specifying the latest version of Selenium in case the provider is giving you 4.0, which may cause problems. |
Thank you Titus, I will stick to Java 11 for time being. IS there anything wrong, I am passing the proxy and the credentials. I got these code from the previous ticket #10231 (comment) . Should I be changing anything on this. Also BitBar(Service provided) is not getting my request I did a debug and see that I get 407, so the proxy is not getting authenticated. What is wrong in the above section of the code (// CONFIG TO ADD CREDENTIALS) in which I am trying to authenticate proxy. |
You're putting credentials both in the proxy object and in the client config directly. I think you just want it in proxy, so try removing authenticateAs |
THank you Titus, I am not adding authentication in proxy but just adding it in config. If I remove AuthenticateAs from config, then proxy will not be authenticated. |
You're right, and it looks like what you have matches what is supposed to work: #10231 (comment) One of the other Java devs might need to help out with this one. |
hey @pvsharma, Configure the proxy directly within the Proxy object instead of using ClientConfig for authentication and then try. |
Thank you @Vishwas-web By just using the Proxy object, I cannot authenticate with credentials and it fails hence after going through various channels, found this solution which works with earlier version but fails on the latest version #10231 (comment) |
It looks like import java.net.Authenticator;
//...your code
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
// Create an authenticator to provide the credentials
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(proxyUser, proxyPassword.toCharArray());
}
});
//...rest of your code |
What happened?
I am trying to launch a browser in BitBAr from my IDE setup. I have to bypass the proxy and then connect to remote server. After doing some google & stackoverlow help I wrote this code. But it does not seem to work with Java 11 but it connects the remote browser with Java 8. Can someone please help as I have spent lot of time undertanding the issue byt failed to get the solution
Selenium version used - 4.21.1 (used previous ones also) Jave version (11)
The errors I get are
getMessage(): Could not start a new session. Unable to parse remote response:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Unable to parse remote response:
Caused by: org.openqa.selenium.json.JsonException: Expected to read a START_MAP but instead have: END. Last 0 characters read:
How can we reproduce the issue?
Relevant log output
Operating System
macOS
Selenium version
4.21
What are the browser(s) and version(s) where you see this issue?
BitBar Chrome
What are the browser driver(s) and version(s) where you see this issue?
Chrome 123
Are you using Selenium Grid?
4.0
The text was updated successfully, but these errors were encountered: