'Unable to click on element with error "org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable"

Below is my DOM structure and I am not able to click on Request Map.

enter image description here

I am using below code.Please help!!

WebDriverWait wait = new WebDriverWait(webDriver, Duration.ofSeconds(50)); wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//span[normalize-space()='Request Map']")));

        SearchContext shadow = webDriver.findElement(By.xpath("//span[normalize-space()='Request Map']")).getShadowRoot();
      
        shadow.findElement(By.xpath("//span[normalize-space()='Request Map']")).click();


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source