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]: Getting continuous Exception in Selenium Console while using HasAuthentication #14062

Open
jaydjana87 opened this issue Jun 1, 2024 · 8 comments
Labels
C-devtools BiDi or Chrome DevTools related issues C-java I-defect needs-triaging

Comments

@jaydjana87
Copy link

jaydjana87 commented Jun 1, 2024

What happened?

I am getting popup while opening url. I have tried to pass credential using HasAuthentication method and it worked but I am getting continious error/warning in console which is blocking my console. FYI I have open new Tab/window and close old Tab/window before opening url

How can we reproduce the issue?

HasAuthentication authentication = (HasAuthentication) driver;
		authentication.register(() -> new UsernameAndPassword(username, password));
		driver.get(url);

Or 

	Predicate<URI> uriPredicate = uri -> uri.getHost().contains(properties.getProperty("proxyURL"));
		((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of(username, password));

Relevant log output

org.openqa.selenium.devtools.DevToolsException: {"id":12300,"error":{"code":-32602,"message":"Invalid InterceptionId."},"sessionId":"A46D49B39B1201C1DD0F0A571254628E"}
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: driver.version: unknown
	at org.openqa.selenium.devtools.Connection.sendAndWait(Connection.java:193)
	at org.openqa.selenium.devtools.DevTools.send(DevTools.java:89)
	at org.openqa.selenium.devtools.idealized.Network.lambda$prepareToInterceptTraffic$4(Network.java:225)
	at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:55)
	at org.openqa.selenium.devtools.idealized.Network.lambda$prepareToInterceptTraffic$5(Network.java:248)
	at org.openqa.selenium.devtools.Connection.lambda$handle$5(Connection.java:345)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
	at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1850)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.openqa.selenium.devtools.Connection.handle(Connection.java:308)
	at org.openqa.selenium.devtools.Connection$Listener.lambda$onText$0(Connection.java:236)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.openqa.selenium.WebDriverException: {"id":12300,"error":{"code":-32602,"message":"Invalid InterceptionId."},"sessionId":"A46D49B39B1201C1DD0F0A571254628E"}
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: driver.version: unknown
	at org.openqa.selenium.devtools.Connection.handle(Connection.java:272)
	... 4 more

Exception in thread "CDP Connection" org.openqa.selenium.devtools.DevToolsException: {"id":12300,"error":{"code":-32602,"message":"Invalid InterceptionId."},"sessionId":"A46D49B39B1201C1DD0F0A571254628E"}
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: driver.version: unknown
	at org.openqa.selenium.devtools.Connection$Listener.lambda$onText$0(Connection.java:239)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.openqa.selenium.devtools.DevToolsException: {"id":12300,"error":{"code":-32602,"message":"Invalid InterceptionId."},"sessionId":"A46D49B39B1201C1DD0F0A571254628E"}
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: driver.version: unknown
	at org.openqa.selenium.devtools.Connection.sendAndWait(Connection.java:193)
	at org.openqa.selenium.devtools.DevTools.send(DevTools.java:89)
	at org.openqa.selenium.devtools.idealized.Network.lambda$prepareToInterceptTraffic$4(Network.java:225)
	at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:55)
	at org.openqa.selenium.devtools.idealized.Network.lambda$prepareToInterceptTraffic$5(Network.java:248)
	at org.openqa.selenium.devtools.Connection.lambda$handle$5(Connection.java:345)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
	at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1850)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.openqa.selenium.devtools.Connection.handle(Connection.java:308)
	at org.openqa.selenium.devtools.Connection$Listener.lambda$onText$0(Connection.java:236)
	... 3 more
Caused by: org.openqa.selenium.WebDriverException: {"id":12300,"error":{"code":-32602,"message":"Invalid InterceptionId."},"sessionId":"A46D49B39B1201C1DD0F0A571254628E"}
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: driver.version: unknown
	at org.openqa.selenium.devtools.Connection.handle(Connection.java:272)
	... 4 more
Jun 01, 2024 10:38:37 AM org.openqa.selenium.devtools.Connection$Listener lambda$onText$0
WARNING: Unable to process: {"method":"Fetch.requestPaused","params":{"requestId":"interception-job-2681.0","request":{"url":"https://guardian-sit2.crm9.dynamics.com/api/data/v9.0/GetClientMetadata(ClientMetadataQuery=@ClientMetadataQuery)?@ClientMetadataQuery={%22MetadataType%22%3A%22savedview%22,%22MetadataSubtype%22%3A%22MAIN_APPLICATION_VIEW%22,%22EntityLogicalName%22%3A%22mcshhs_intake%22,%22MetadataId%22%3A%222f280994-42ef-e911-a993-001dd800b582%22,%22GetDefault%22%3Afalse,%22ChangedAfter%22%3A%22228329132%22,%22AppId%22%3A%225f63bfe0-730d-4108-a24a-82333b4cac7b%22}&umv=228329132&mv=228713547&rde=1&api-version=9.1","method":"GET","headers":{"Cookie":"ARRAffinity=dac938fcdeaf10ca75bf0122af2e62e128beb82c714d9a08173f2d13cce5ea315ab954b42cfa12ad9f33ddc80a07e15dd633bd57139a65479392e46e5242529408DC81FCEFBF8A8A2037572863; ReqClientId=a43dd3cb-daa9-415b-ba75-722435121327;

Operating System

Windows 11

Selenium version

Selenium 4.18.1 /Java 17

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

Chrome Version 125.0.6422.113 (Official Build) (64-bit)

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

Chrome Driver

Are you using Selenium Grid?

No

Copy link

github-actions bot commented Jun 1, 2024

@jaydjana87, 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 titusfortner added C-devtools BiDi or Chrome DevTools related issues C-java labels Jun 1, 2024
@jaydjana87
Copy link
Author

Seems like HASAuthentication works fine first time but if we try same after logging out from application and login with other user ID it worked but in console throws unnecessary exception and hanged console

@titusfortner titusfortner added I-logging Applied to issues where logging information would help troubleshoot and removed needs-triaging labels Jun 4, 2024
Copy link

github-actions bot commented Jun 4, 2024

We need more information about this issue in order to troubleshoot.

Please turn on logging and re-run your code. Information on how to adjust logs for your language can be found in our
Troubleshooting documentation.

@jaydjana87
Copy link
Author

Here is the step to reproduct

  1. Open Url (Example:https://the-internet.herokuapp.com/basic_auth)

  2. Enter username and password
    HasAuthentication authentication = (HasAuthentication) driver;
    authentication.register(() -> new UsernameAndPassword(username, password));

  3. Now Clear browser history and refresh the page

  4. Again popup will come for Authentication

  5. Enter username and pass using below API
    HasAuthentication authentication = (HasAuthentication) driver;
    authentication.register(() -> new UsernameAndPassword(username, password));
    Error Logs.txt

  6. Error logs will come in console heavily

Error logs attaed

@titusfortner titusfortner removed the I-logging Applied to issues where logging information would help troubleshoot label Jun 5, 2024
@esakkisatya
Copy link

@pujagani I saw you contributing immensely around this HasAuthentication issues. Tagged you to check if you can help here. Can you please check and guide accordingly. Thanks in advance.

@pujagani
Copy link
Contributor

pujagani commented Aug 5, 2024

Thank you for sharing the details. Can you provide a code example to reproduce this? Just want to know the commands being used, it will help us debug better.

@esakkisatya
Copy link

@pujagani The only issue here is I am using an application which works behind our org vpn. I am just scrubbing off the restricted information and sharing the code snippet with you.
HasAuthentication hasAuthentication = (HasAuthentication) driver; Predicate<URI> uriPredicate = uri -> uri.getHost().contains("appDomain"); hasAuthentication.register(uriPredicate, UsernameAndPassword.of(userName, password)); driver.get(ConfigReaderUtility.getPropertyValue("url"));

When this takes some time to load, I observe a lot of exception getting logged into console.

@pujagani
Copy link
Contributor

I appreciate your response here. But I will need a reproducible test script, it does not have to be the same code but a piece of code that can reproduce this. Can you also share the exceptions getting logged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-devtools BiDi or Chrome DevTools related issues C-java I-defect needs-triaging
Projects
None yet
Development

No branches or pull requests

4 participants