healenium / healenium-web

Self-healing library for Selenium Web-based tests
Apache License 2.0
169 stars 40 forks source link

Unable to Heal and Getting Warning com.epam.healenium.client.RestClient - Failed to make response #107

Closed saurabhsrivastava2009 closed 3 years ago

saurabhsrivastava2009 commented 3 years ago

Hi Team,

I'm trying to execute a simple test by using SelfHealingDriver. Here are the steps that I'm performing from the step

  1. Open DuckDuckgo
  2. Wait for search input to be visible and then enter a text
  3. Click on search button

These steps are working with the correct CSS Selectors, but in runtime if I change the search input CSS selector, the healing algorithm is not working and the test fails at step 2 with the below error when server = localhost Trying to heal... [main] WARN com.epam.healenium.client.RestClient - Failed to make response java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:7878 at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247) at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:165) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) at okhttp3.RealCall.execute(RealCall.java:77) at com.epam.healenium.client.RestClient.getLastValidPath(RestClient.java:151) at com.epam.healenium.SelfHealingEngine.lambda$getLastValidPaths$7(SelfHealingEngine.java:285) at java.util.Optional.flatMap(Optional.java:241) at com.epam.healenium.SelfHealingEngine.getLastValidPaths(SelfHealingEngine.java:285) at com.epam.healenium.SelfHealingEngine.findNewLocations(SelfHealingEngine.java:197) at com.epam.healenium.service.impl.HealingServiceImpl.healLocators(HealingServiceImpl.java:94) at com.epam.healenium.service.impl.HealingServiceImpl.heal(HealingServiceImpl.java:53) at com.epam.healenium.handlers.proxy.BaseHandler.lookUp(BaseHandler.java:88) at com.epam.healenium.handlers.proxy.BaseHandler.findElement(BaseHandler.java:53) at com.epam.healenium.handlers.proxy.SelfHealingProxyInvocationHandler.invoke(SelfHealingProxyInvocationHandler.java:39) at com.sun.proxy.$Proxy5.findElement(Unknown Source) at com.vhyd.vhydInterview.testng.basicActions.BasicActions.waitForElementVisible(BasicActions.java:32) at com.vhyd.vhydInterview.testng.NewTest.searchSomething(NewTest.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86) at org.testng.internal.Invoker.invokeMethod(Invoker.java:643) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) at org.testng.TestRunner.privateRun(TestRunner.java:782) at org.testng.TestRunner.run(TestRunner.java:632) at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) at org.testng.SuiteRunner.run(SuiteRunner.java:268) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244) at org.testng.TestNG.runSuitesLocally(TestNG.java:1169) at org.testng.TestNG.run(TestNG.java:1064) at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66) at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109) Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:81) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:162) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394) at java.net.Socket.connect(Socket.java:606) at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:245) ... 53 more [main] WARN com.epam.healenium.service.impl.HealingServiceImpl - New element locators have not been found

I thought as I'm navigating directly to the page, so removed localhost from the properties file. But still the healing is not working. *** Element info: {Using=css selector, value=[id="search_form_input_homepage"]} Trying to heal... [main] WARN com.epam.healenium.client.RestClient - Failed to make response java.lang.NullPointerException at com.epam.healenium.client.RestClient.getLastValidPath(RestClient.java:141) at com.epam.healenium.SelfHealingEngine.lambda$getLastValidPaths$7(SelfHealingEngine.java:285) at java.util.Optional.flatMap(Optional.java:241) at com.epam.healenium.SelfHealingEngine.getLastValidPaths(SelfHealingEngine.java:285) at com.epam.healenium.SelfHealingEngine.findNewLocations(SelfHealingEngine.java:197) at com.epam.healenium.service.impl.HealingServiceImpl.healLocators(HealingServiceImpl.java:94) at com.epam.healenium.service.impl.HealingServiceImpl.heal(HealingServiceImpl.java:53) at com.epam.healenium.handlers.proxy.BaseHandler.lookUp(BaseHandler.java:88) at com.epam.healenium.handlers.proxy.BaseHandler.findElement(BaseHandler.java:53) at com.epam.healenium.handlers.proxy.SelfHealingProxyInvocationHandler.invoke(SelfHealingProxyInvocationHandler.java:39) at com.sun.proxy.$Proxy5.findElement(Unknown Source) at com.vhyd.vhydInterview.testng.basicActions.BasicActions.waitForElementVisible(BasicActions.java:32) at com.vhyd.vhydInterview.testng.NewTest.searchSomething(NewTest.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86) at org.testng.internal.Invoker.invokeMethod(Invoker.java:643) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) at org.testng.TestRunner.privateRun(TestRunner.java:782) at org.testng.TestRunner.run(TestRunner.java:632) at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) at org.testng.SuiteRunner.run(SuiteRunner.java:268) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244) at org.testng.TestNG.runSuitesLocally(TestNG.java:1169) at org.testng.TestNG.run(TestNG.java:1064) at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66) at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109) [main] WARN com.epam.healenium.service.impl.HealingServiceImpl - New element locators have not been found

I'm not sure, if I'm missing something here! I have followed the steps mentioned here https://github.com/healenium/healenium-web/blob/master/README.md

Thanks for helping. :)

GannaChernyshova commented 3 years ago

Hi @saurabhsrivastava2009 Have you started the backend from Step 0. Start hlm-backend by instruction (https://github.com/healenium/healenium-backend) ?

saurabhsrivastava2009 commented 3 years ago

Hi @GannaChernyshova Yes I have started from step 0. The error is still the same.

GannaChernyshova commented 3 years ago

Could you please verify that hlm-backend container is up and running without errors? This error "Failed to connect to localhost/0:0:0:0:0:0:0:1:7878" tells that something is wrong with backend. It occurs if it started with errors, not running or you have no access to it if started on remote server.

saurabhsrivastava2009 commented 3 years ago

@GannaChernyshova Thanks.. :) There were indeed some errors related to port. Also in the properties file, I was not using the correct server host. After fixing that, I was able to do a docker up and was able to start the following. Thank you again :)

Prasan02 commented 3 years ago

@saurabhsrivastava2009 may i know where did you find port issue? looks like i am facing the same issue, but not able to figure out where it went wrong. Please help

saurabhsrivastava2009 commented 3 years ago

@Prasan02 I was running something else on the specified port. After cleaning that port, I was able to restart and make it work.

Yohitha commented 2 years ago

@GannaChernyshova Thanks.. :) There were indeed some errors related to port. Also in the properties file, I was not using the correct server host. After fixing that, I was able to do a docker up and was able to start the following. Thank you again :)

  • Starting infra_db_1 ... done
  • Creating infra_healenium_1 ... done

@saurabhsrivastava2009 - how did you resolve the port issue? Failed to connect to localhost/0:0:0:0:0:0:0:1:7878 - unable to resolve..

AkashSai10 commented 1 year ago

@GannaChernyshova Thanks.. :) There were indeed some errors related to port. Also in the properties file, I was not using the correct server host. After fixing that, I was able to do a docker up and was able to start the following. Thank you again :)

  • Starting infra_db_1 ... done
  • Creating infra_healenium_1 ... done

my docker and PLsql is up but i am still facing this issue. Can you please help in this case?