Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8160297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:11:09+00:00 2026-06-06T18:11:09+00:00

I am having trouble getting this invisibilityOfElementLocated() method to work. Here is the code

  • 0

I am having trouble getting this “invisibilityOfElementLocated()” method to work. Here is the
code I am using and I am witnessing the element disappear after about 35 seconds with my own eyes but Webdriver does not detect this and crashes on this code and skips the test. Would love if someone had a diffferent method that worked better.

if ( driver.findElement( By.xpath( "//div[@class='Caption']" )).isDisplayed() ) {
  System.out.println("Caption is visible.");
}
WebDriverWait wait1 = new WebDriverWait( driver , 60 ); 
wait1.until( 
  ExpectedConditions.invisibilityOfElementLocated( 
    By.xpath( "//div[@class='Caption']" ) 
  )
);

Here is the error I causes:

org.openqa.selenium.TimeoutException: Timed out after 60 seconds waiting for
  element to no longer be visible: By.xpath: //div[@class='Caption']
Build info: version: '2.24.1', revision: '17205', time: '2012-06-19 16:53:24'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', 
  java.version: '1.6.0_31'
Driver info: driver.version: unknown
    at org.openqa.selenium.support.ui.FluentWait.timeoutException(
          FluentWait.java:251)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:220)
    at test.TaskListPage.isLoaded(TaskListPage.java:43)
    at org.openqa.selenium.support.ui.SlowLoadableComponent.get(
         SlowLoadableComponent.java:48)
    at test.TaskListPage.<init>(TaskListPage.java:31)
    at test.Form.testLogin(Form.java:153)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
        NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
           DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
          FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(
          ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(
          FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(
          InvokeMethod.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(
          BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(
           BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:24)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.internal.runners.statements.RunAfters.evaluate(
       RunAfters.java:30)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

Also, this method gives a similar error:

ExpectedCondition<Boolean> e = new ExpectedCondition<Boolean>() {
  public Boolean apply(WebDriver d) {
    WebElement tE = driver.findElement( By.className("Caption") );
    // return the invisibility instead of the visibility
    return !tE.isDisplayed();
  }
};
WebDriverWait w = new WebDriverWait(driver, 60);
w.until(e); 

I had some success with this but it still throws an exception when the element finally becomes invisible and then bounces me out of my test case:

while ( 
  // dialogMiddleCenterInner is a td that contains the Caption div
  driver.findElement( By.className("dialogMiddleCenterInner")
).isDisplayed() ) {
  System.out.println("Caption is visible.  Waiting for login.");
  AFormUtils.waitSeconds(2);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:11:10+00:00Added an answer on June 6, 2026 at 6:11 pm

    Thanks to Slanec for trying to help me. Ok, this was the answer. It seems that, whether or not I used ExpectedCondition or not, I just had to handle the exception instead of allowing it to throw, but it finally works:

    try {
      while ( 
        // dialogMiddleCenterInner is a td that contains the Caption div
        driver.findElement( By.className("dialogMiddleCenterInner")
      ).isDisplayed() ) {
      System.out.println("Caption is visible.  Waiting for login.");
      MyUtils.waitSeconds(2);
    } catch ( NoSuchElementException nse ) {
      nse.printStackTrace(); // print but simulate .ignoring() by catching exception
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having trouble getting this to work, here´s a quick overview of the idea.
Having trouble getting the following code to work: $('#changeMode').button().click(function(){ $('#playfield').toggle(function() { $(this).switchClass(gridView,plainView); }, function()
I'm having some trouble getting this to work. This is the code I want
Ok this seems so silly but I'm having some trouble getting this to work.
I am having trouble getting my datasource linked to my repeater through this code
I'm having trouble using variables in my SQL WHERE clause. I'm getting this error:
I'm having trouble getting the CanExecute method of my command to work property. I've
Having trouble getting this to work. What's strange is that I have 10 bookmarks
I'm having trouble getting this script to work. <asp:DropDownList CssClass=workUnit Width=80 ID=dropdownWorkUnit runat=server Visible=false
I'm having trouble getting this to work...it just replaces the entire page with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.