SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
29.78k stars 8.02k forks source link

[🐛 Bug]: Getting continuous Exception in Selenium Console while using HasAuthentication #14062

Open jaydjana87 opened 1 month ago

jaydjana87 commented 1 month ago

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

github-actions[bot] commented 1 month ago

@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!

jaydjana87 commented 1 month ago

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

github-actions[bot] commented 1 month ago

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 commented 1 month ago

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