healenium / healenium-web

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

Getting java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 error though the code is working fine without healenium #160

Closed Tejaswiniqa closed 2 years ago

Tejaswiniqa commented 2 years ago

java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 is thrown though the code is working fine wthout using healenium

StacKTrace: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) at java.base/java.util.Objects.checkIndex(Objects.java:359) at java.base/java.util.ArrayList.get(ArrayList.java:427) at com.epam.healenium.SelfHealingEngine.lambda$collectMetrics$4(SelfHealingEngine.java:262) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178) at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602) at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129) at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647) at com.epam.healenium.SelfHealingEngine.collectMetrics(SelfHealingEngine.java:264) at com.epam.healenium.SelfHealingEngine.findNearest(SelfHealingEngine.java:246) at com.epam.healenium.SelfHealingEngine.findNewLocations(SelfHealingEngine.java:198) at com.epam.healenium.service.impl.AbstractHealingServiceImpl.healLocator(AbstractHealingServiceImpl.java:54) at com.epam.healenium.service.impl.HealingServiceImpl.heal(HealingServiceImpl.java:42) at com.epam.healenium.handlers.proxy.BaseHandler.lookUp(BaseHandler.java:91) at com.epam.healenium.handlers.proxy.BaseHandler.findElement(BaseHandler.java:56) at com.epam.healenium.handlers.proxy.SelfHealingProxyInvocationHandler.invoke(SelfHealingProxyInvocationHandler.java:39) at jdk.proxy2/jdk.proxy2.$Proxy23.findElement(Unknown Source) at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:205) at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:201) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249) at jstack.util.CommonMethods.waitUntilTime(CommonMethods.java:19) at jstack.pages.BasePage.checkIfElementPresent(BasePage.java:44) at jstack.pages.LoginPage.CheckIfUserOnTenantPage(LoginPage.java:65) at jstack.pages.LoginPage.doLogin(LoginPage.java:75) at jstack.parallel.TravelReqSteps.user_successfully_logs_into_j_stack_application_using_and(TravelReqSteps.java:40)

Healenium backend version:3.1.5 healenium:3.3

ElenaStepuro commented 2 years ago

Hello @Tejaswiniqa ! In case, you've faced with this in findElements method, than there is a known issue working with findElements. Follow this issue to know about updates: https://github.com/healenium/healenium-web/issues/159

aravindhakrishnan148 commented 2 years ago

Hello @Tejaswiniqa ! In case, you've faced with this in findElements method, than there is a known issue working with findElements. Follow this issue to know about updates: #159

I am getting the same issue in element.click() while using healenium but works fine while running my code without healenium

ElenaStepuro commented 2 years ago

Hello @aravindhakrishnan148 ! What type does your element has?

ElenaStepuro commented 2 years ago

Fixed in hlm-web version 3.2.0