Element is not clickable at point (x, y) because another element obscures it - BLOCK UI class



  • When I run my test, I receive an error because an element obscures the element I want to click.

    How do I create a wait that will be executed only IF this class is detected, wait it to disappear and finally continue the test?

    I tried to make a wait but when then the driver will search this BLOCK-UI, it throws the error "element was not found". How do I create this wait ONLY WHEN this element is displayed?

    [Test]
            public void TC_1848() // Verify Manage V-Tenant USERS Groups Office365 Groups TestCase
            {
                var vtenants = new ObjectRepository.VTenants(driver);
    
                ActionModules.SearchVTenant(driver);
                Thread.Sleep(1500);
                vtenants.VT_Usersbtn.Click();
                vtenants.VT_UserGroupsbtn.Click();
    
    ERROR:  Element <a class="button button-fleft searchButton" href="#"> is not clickable at point (577.6166763305664,225.06666564941406) because another element <div class="blockUI blockOverlay"> obscures it
    


  • You have two options:

    1 - Wait for the invisibility of an element

    wait.Until(ExpectedConditions.InvisibilityOfElementLocated(element));
    

    2 - Wait for the element to be clickable

    wait.Until(ExpectedConditions.ElementToBeClickable (element));
    

    You can find other ExpectedConditions here.

    Note: wait is simply a WebDriverWait object

    var wait = new WebDriverWait(browser.Driver, new TimeSpan(0, 0, seconds));
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2