-
-
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]: HasAuthentication is not working for Chromium browsers when they are executed in Selenium Grid #9934
Comments
Issue is reproducible with the following code as well
|
Same applies to the HasDevTools interface in a very similar scenario |
Thank you for providing the details. I was able to reproduce the error you are facing. The RemoteDriver needs to be augmented with the HasDevTools interface first. Then it needs to be augmented with the HasAuthentication interface. This gets the RemoteWebDriver ready to handle and intercept authentication requests. Adding a working example below. I recommend going through it and trying it out and providing feedback.
|
Hi @pujagani , Thank you for the help. I can confirm that code example above solved the problem. |
Thank you for trying it out. Will take this opportunity to add the example to the Selenium documentation. |
Hello @pujagani , Based on the solution above driver needs to be augmented in order to get access to HasDevTools interface. After that devtools session must be created and then driver must be augmented one more time. I guess same should be applied for the rest of the interfaces part of the ChromiumDriver. Are there any plans to make the second augmentation one idea easier by providing driver + active devtools instance and this to unlock all other interfaces? PS: Feel free to add the example above in the documentation. It would help a lot of people! |
@NikolayStanoev You make a valid case. The whole idea of Augmentation is to be able to add interfaces and implementation as required. A similar error is faced while using HasLogEvents interface as well. Since most CDP-related interfaces require HasDevTools, I think it might be a good idea to chain this in a manner that is easier to use. I will look into how we can achieve that and bring it up with the core contributors to identify the best way to solve this. |
Augmentation is only needed for RemoteWebDriver instances because the applicable browser drivers themselves implement the interface. This doesn't actually address making the second call easier, but with respect to getting an augmented driver in the first place, I wanted to point out that you can use Just thought I'd mention it since there are so few resources out there right now discussing the Augmenter, and it's super powerful. |
Thank you @titusfortner for pointing this out. It helped me get some insights into how certain AugmentationProviders are loaded by the Java class loader. Also, the code example now looks a tad cleaner :)
|
Hi @pujagani, I am not able to execute the example above. It fails during compilation on that line If I update the line to
The full code with all imports looks this way:
Do you see a problem in the code above or something that I am missing? |
Thank you for trying @NikolayStanoev. Sincere apologies, I was working on fixing the augmented chaining bit and I confused the example of HasAuthentication with HasLogEvents and shared that. I have updated the comment with a valid example. Would appreciate it if you could have a look at that, please. Thank you! The error you faced
|
I looked into this in-depth and what I understand is, there are a set of interfaces (Example: HasDevTools), that are autoloaded (Hence, From this exercise, it is definitely clear that in-depth documentation for Augmenter and how powerful it is is required. Will get started on the same. |
Hi @pujagani , I can confirm that ChromeDevToolsAugmenterAuthenticationSimplify example works fine and looks simpler for sure. Thank you a lot for spending time to update the documentation with those Augmenter implementations. |
I see from your comment above that you have ChromeDevToolsAugmenterAuthenticationSimplify working. With both ChromeDevToolsAugmenterAuthentication and ChromeDevToolsAugmenterAuthenticationSimplify my browser launches (on my Selenoid instance) but then throws the exception
I'm wondering if you might be able to suggest what could be the issue I'm missing. |
Hi @nieperdragon , I haven`t tried with Selenoid instance. Maybe problem comes from there. Both solutions - ChromeDevToolsAugmenterAuthentication and ChromeDevToolsAugmenterAuthenticationSimplify works fine when they are executed against selenium grid in standalone / hub&node mode. Can you share the code that you are using? |
So it's the same code as above with a couple of changes (some required Chrome Options) and of course the URL. `
|
@nieperdragon Based on what is discussed, I am sensing it could be potentially due to a Java version or due to the docker usage. It sounds very similar to #9803. |
Thank you @pujagani |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What happened?
I am able to use register method from HasAuthentication interface using chromium drivers running on local machine. But when i try to use chromium browser (edge/chrome) which is part of selenium grid I am getting the following error when I try to use HasAuthentication interface.
Code where the test fails:
((HasAuthentication) webDriver).register(() -> new UsernameAndPassword("admin", "admin"));
Error:
java.lang.ClassCastException: class org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$gPlLDnEY cannot be cast to class org.openqa.selenium.HasAuthentication (org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$gPlLDnEY is in unnamed module of loader net.bytebuddy.dynamic.loading.ByteArrayClassLoader @77681ce4; org.openqa.selenium.HasAuthentication is in unnamed module of loader 'app')
How can we reproduce the issue?
Relevant log output
Operating System
Windows 10 / MacOS BigSur 11.3.1
Selenium version
4.0.0
What are the browser(s) and version(s) where you see this issue?
Chrome 94
What are the browser driver(s) and version(s) where you see this issue?
chromedriver 94.0.4606.61
Are you using Selenium Grid?
Yes - 4.0.0
The text was updated successfully, but these errors were encountered: