healenium / healenium-web

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

[BUG]: com.epam.healenium.handlers.proxy.SelfHealingProxyInvocationHandler.invoke(SelfHealingProxyInvocationHandler.java:39) #194

Closed mpchethan closed 2 years ago

mpchethan commented 2 years ago

Describe the bug

when run the getting below error Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 103.0.5060.114, chrome: {chromedriverVersion: 102.0.5005.61 (0e59bcc00cc4..., userDataDir: C:\Users\00005593\AppData\L...}, goog:chromeOptions: {debuggerAddress: localhost:60337}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), se:cdp: ws://localhost:60337/devtoo..., se:cdpVersion: 103.0.5060.114, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true} Session ID: 59e17b407beae85f8ac8de250f71f238 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200) at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133) at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184) at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:558) at org.openqa.selenium.remote.ElementLocation$ElementFinder$2.findElement(ElementLocation.java:162) at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:60) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:382) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:374) at com.epam.healenium.processor.FindElementProcessor.execute(FindElementProcessor.java:24) at com.epam.healenium.processor.BaseProcessor.process(BaseProcessor.java:41) at com.epam.healenium.handlers.proxy.BaseHandler.findElement(BaseHandler.java:58) at com.epam.healenium.handlers.proxy.SelfHealingProxyInvocationHandler.invoke(SelfHealingProxyInvocationHandler.java:39) at com.sun.proxy.$Proxy22.findElement(Unknown Source) at org.openqa.selenium.support.pagefactory.DefaultElementLocator.findElement(DefaultElementLocator.java:70) at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:39) at com.sun.proxy.$Proxy29.getWrappedElement(Unknown Source) at org.openqa.selenium.interactions.PointerInput$Origin.asArg(PointerInput.java:206) at org.openqa.selenium.interactions.PointerInput$Move.encode(PointerInput.java:157) at org.openqa.selenium.interactions.Sequence.encode(Sequence.java:73) at org.openqa.selenium.interactions.Sequence.toJson(Sequence.java:82)

How to reproduce the issue

Step 1:run docker and ensure 3 containers running
step run scripts

Logs appeared during using Healenium

at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.openqa.selenium.json.JsonOutput.lambda$new$23(JsonOutput.java:169)
    at org.openqa.selenium.json.JsonOutput.write(JsonOutput.java:287)
    at org.openqa.selenium.json.JsonOutput.lambda$new$24(JsonOutput.java:182)
    at com.google.common.collect.SingletonImmutableBiMap.forEach(SingletonImmutableBiMap.java:68)
    at org.openqa.selenium.json.JsonOutput.lambda$new$25(JsonOutput.java:177)
    at org.openqa.selenium.json.JsonOutput.write(JsonOutput.java:287)
    at org.openqa.selenium.json.JsonOutput.write(JsonOutput.java:278)
    at org.openqa.selenium.json.Json.toJson(Json.java:42)
    at org.openqa.selenium.remote.codec.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:259)
    at org.openqa.selenium.remote.codec.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:127)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:172)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:558)
    at org.openqa.selenium.remote.RemoteWebDriver.perform(RemoteWebDriver.java:626)
    ... 52 more
    Suppressed: org.openqa.selenium.json.JsonException: Attempting to close incomplete json stream
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'AGI-LT-1592', ip: '172.22.80.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_202'
Driver info: driver.version: RemoteWebDriver
        at org.openqa.selenium.json.JsonOutput.close(JsonOutput.java:303)
        at org.openqa.selenium.json.Json.toJson(Json.java:40)
        ... 59 more
Caused by: java.lang.reflect.InvocationTargetException
    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.openqa.selenium.json.JsonOutput.convertUsingMethod(JsonOutput.java:358)
    ...

Expected behavior

No response

Actual behavior

No response

Healenium Web version

3.2.5

Healenium Backend version

3.2.2

Selenium version

4.1.2

Platform

java

Properties file

recovery-tries=1 score-cap=.2 heal-enabled=true serverHost = localhost serverPort = 7878

Additional context

No response

mpchethan commented 2 years ago

more info # com.arisglobal.LSHE2.StepDefinitions.CaseManagement.NewCase.FULLDATAENTRYFORM.GeneralSteps.setCaseTypeDetails(int) java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy22.perform(Unknown Source) at org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:656)

Alex-Reif commented 2 years ago

Hi @mpchethan , Could you provide the code to create SelfHealingDriver ?

mpchethan commented 2 years ago

private WebDriver createLocalDriver() throws IOException { if (System.getProperty("BROWSER").equalsIgnoreCase("chrome")) { System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")

mpchethan commented 2 years ago

Hi can you please help me to resolve this issue

ElenaStepuro commented 2 years ago

Hello @mpchethan Try to set properties like in example: hlm.server.url = http://localhost:7878 hlm.imitator.url = http://localhost:8000

Also, in logs I can see that you created RemoteWebDriver but you added the with creating WebDriver. So, what driver do you use in tests?

mpchethan commented 2 years ago

Same issue after set properties like in example: hlm.server.url = http://localhost:7878/ hlm.imitator.url = http://localhost:8000/ and we are using WebDriver

ElenaStepuro commented 2 years ago

Could you also provide logs from docker container?

Alex-Reif commented 2 years ago

Hi @mpchethan , 'Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element:' means webDriver cannot looking for target locator. There is no such element on the page. Before try to heal element, you have to execute pure tests with will be success. This test data will act as a etalon data to future healing.

mpchethan commented 2 years ago

Pure test means our test with healenium should pass first and later if any changes in locator. Healenium will heal with new locator.correct me if I’m wrong please

Thanks Chethan

Sent from my iPhone

On 21-Jul-2022, at 3:16 PM, Aliaksei-Ashukha @.***> wrote:

 Hi @mpchethan , 'Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element:' means webDriver cannot looking for target locator. There is no such element on the page. Before try to heal element, you have to execute pure tests with will be success. This test data will act as a etalon data to future healing.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

Alex-Reif commented 2 years ago

@mpchethan Yes, you are right. You can watch the video: how healenium works: https://youtu.be/Av327EElMCo?t=37

mpchethan commented 2 years ago

Thank you

Sent from my iPhone

On 21-Jul-2022, at 4:02 PM, Aliaksei-Ashukha @.***> wrote:

 Yes, you are right. You can watch the video: how healenium works: https://youtu.be/Av327EElMCo?t=37

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.