From: RBRi <rb...@us...> - 2019-08-01 17:32:20
|
The only option from my point of view is to remove the class from the js-setup. But this is so far not supported (at least what i can see at the moment). If you still need this feature - please open an new issue on github. --- ** [bugs:#2019] Unwanted WebSocket Connection** **Status:** open **Group:** 2.35.0 **Created:** Fri Jul 05, 2019 10:55 PM UTC by Ahsan Kazmi **Last Updated:** Thu Jul 11, 2019 07:05 PM UTC **Owner:** nobody I tried searching for a solution but was unable to find how to prevent connection to a websocket. I only need to read html that is rendered through javascript, and I am able to do that fine. The following is my code: webClient = new WebClient(BrowserVersion.CHROME); webClient.getOptions().setUseInsecureSSL(true); webClient.getOptions().setJavaScriptEnabled(true); page = webClient.getPage(address); webClient.waitForBackgroundJavaScript(3000); List<DomElement> statusElementList = page.getByXPath("//span[contains(@class, 'state-title')]"); String status = statusElementList.get(0).getFirstChild().toString(); The following is the stacktrace I am seeing: websocket error info WebConsole.java : 422 2019-07-05 22:44:09 [UTC] [HttpClient@1433621164-98] INFO c.g.htmlunit.WebConsole websocket closed. ERROR c.g.h.javascript.host.WebSocket - [trueEDGE] Customer: qa-uss, Device: connect error for url 'wss://192.168.44.202/statusd': run WebSocket.java : 179 java.util.concurrent.ExecutionException: org.eclipse.jetty.websocket.api.UpgradeException: 400 Bad Request at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895) at com.gargoylesoftware.htmlunit.javascript.host.WebSocket$1.run(WebSocket.java:175) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591) at java.lang.Thread.run(Thread.java:748) Caused by: org.eclipse.jetty.websocket.api.UpgradeException: 400 Bad Request at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:520) at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193) at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185) at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:459) at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:405) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:297) at org.eclipse.jetty.http.HttpParser.handleContentMessage(HttpParser.java:606) at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1536) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1384) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:170) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:131) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:70) at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:130) at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:116) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:289) at org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:149) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128) at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199) ... 3 common frames omitted --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |