Skip to content

[🐛 Bug]: isDisplayed atom does ignore content-visibility: hidden css property #16054

Closed
@joerg1985

Description

@joerg1985

Description

The isDisplayed atom does return incorrect results for elements with css property content-visibility: hidden set.

Reproducible Code

import java.nio.charset.StandardCharsets;
import java.util.Base64;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;

public class Main111 {

    public static void main(String[] args) throws Exception {
        ChromeDriver cd = new ChromeDriver();
        
        var page = "<div id='a' style='content-visibility: hidden'>A<div id='b'>B</div></div>";
        
        cd.get("data:text/html;charset=utf-8;base64,"
                    + Base64.getEncoder().encodeToString(page.getBytes(StandardCharsets.UTF_8)));

        
        if (cd.findElement(By.id("a")).isDisplayed()) {
            throw new IllegalStateException("A");
        }
        
        if (cd.findElement(By.id("b")).isDisplayed()) {
            throw new IllegalStateException("B");
        }
        
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions