healenium / healenium-web

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

[BUG]: v3.4.4 Healenium driver fails whenever an explicit wait is used #248

Closed vikram0414 closed 3 weeks ago

vikram0414 commented 1 year ago

Describe the bug

healenium-web version: 3.4.4 Healenium driver fails whenever an explicit wait is used. No proper error is traced.

How to reproduce the issue

Use any conditional explicit wait for element to appear on the web Page.
The self healing driver will fail when this line of code is encountered.

code snippet:
                WebDriver delegate = new ChromeDriver(options);
        SelfHealingDriver localDriver = SelfHealingDriver.create(delegate);
        localDriver.manage().window().maximize();

Logs appeared during using Healenium

- IN on test failure method :'org.jsoup.nodes.Element org.jsoup.nodes.Document.root()'

NO proper error message is reported.

Expected behavior

No response

Actual behavior

No response

Healenium Web version

3.4.4

Healenium Backend version

1.3.6

Selenium version

4.11.0

Platform

Java

Properties file

No response

Additional context

No response

Alex-Reif commented 1 year ago

Hello @vikram0414 , Healenium supports Explicity wait from 3.4.4+ version of hlm-web. However, keep in mind that it is available for healenium-web (java only). And it's not available for the Healenium proxy approach.

Create SelfHealingDriverWait instead of WebDriverWait. And pass it SelfHealingDriver instance.

Example: //create Self-healing driver SelfHealingDriver driver = SelfHealingDriver.create(delegate);

WebElement element = new SelfHealingDriverWait(driver, Duration.ofSeconds(10)) .until(ExpectedConditions.visibilityOfElementLocated(By.id("wait_new_element")));

likith-zomentum commented 9 months ago

@Alex-Reif I'm facing the same issue

   public WebElement waitForElementToBeClickableInUI(WebElement element) {
        SelfHealingDriver driver = SelfHealingDriver.create(delegate);
       SelfHealingDriverWait  wait = new SelfHealingDriverWait(driver, explicitWaitTime);
        return wait.until(ExpectedConditions.elementToBeClickable(element));
    }
this is the error im getting 
    [main] ERROR healenium - Failed to get element node path!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from [Unavailable value] (token `JsonToken.NOT_AVAILABLE`)
 at [Source: UNKNOWN; byte offset: #UNKNOWN]
    at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
    at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1752)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1526)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1473)
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer._parseString(StdDeserializer.java:1456)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:48)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)
    at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
    at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:4801)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2974)
    at com.fasterxml.jackson.databind.ObjectMapper.treeToValue(ObjectMapper.java:3438)
    at com.epam.healenium.service.NodeService.toNode(NodeService.java:76)
    at com.epam.healenium.service.NodeService.getNodePath(NodeService.java:54)
    at com.epam.healenium.SelfHealingEngine.lambda$getNodePath$0(SelfHealingEngine.java:121)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
    at java.base/java.util.Collections$2.tryAdvance(Collections.java:4747)
    at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4755)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
    at com.epam.healenium.SelfHealingEngine.getNodePath(SelfHealingEngine.java:122)
    at com.epam.healenium.SelfHealingEngine.saveElements(SelfHealingEngine.java:104)
    at com.epam.healenium.processor.FindElementProcessor.execute(FindElementProcessor.java:25)
    at com.epam.healenium.processor.BaseProcessor.process(BaseProcessor.java:42)
    at com.epam.healenium.handlers.proxy.BaseHandler.findElement(BaseHandler.java:63)
    at com.epam.healenium.handlers.proxy.SelfHealingProxyInvocationHandler.invoke(SelfHealingProxyInvocationHandler.java:39)
    at com.sun.proxy.$Proxy35.findElement(Unknown Source)
    at org.openqa.selenium.support.pagefactory.DefaultElementLocator.findElement(DefaultElementLocator.java:68)
    at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:38)
    at com.sun.proxy.$Proxy38.isDisplayed(Unknown Source)
    at org.openqa.selenium.support.ui.ExpectedConditions.elementIfVisible(ExpectedConditions.java:304)
    at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:37)
    at org.openqa.selenium.support.ui.ExpectedConditions$10.apply(ExpectedConditions.java:290)
    at org.openqa.selenium.support.ui.ExpectedConditions$10.apply(ExpectedConditions.java:287)
    at org.openqa.selenium.support.ui.ExpectedConditions$23.apply(ExpectedConditions.java:656)
    at org.openqa.selenium.support.ui.ExpectedConditions$23.apply(ExpectedConditions.java:652)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:205)
    at com.epam.healenium.SelfHealingDriverWait.until(SelfHealingDriverWait.java:37)
Alex-Reif commented 3 weeks ago

Issue fixed at rev. 3.5.4