title: Can we pass a conditional parameter in ExplicitWait expected condition?
body: <p><a href="https://www.aspsnippets.com/demos/1331/" rel="nofollow noreferrer">This is</a> the website. What I'm trying to do is, click the button and get the text which show the IPAddress of your system.</p>
  
  <p>I'm able to locate the element which is <code>&lt;span&gt;</code>but it shows the text once the get IP Address button clicked.</p>
  
  <p>So my concern is can we use conditions in ExplicitWait ? for example</p>
  
  <pre><code> driver.findElement(By.id("lblIPAddress")).getText().length()&gt;0
  </code></pre>
  
  <p>This is conditional parameter which i want to use in ExplicitWait.</p>
  
  <p>I'm using <code>textToBePresentInElement</code> method in Explicit wait but here I have to pass that string (<code>IP Address: 123.201.110.30</code>) hard coded.</p>
  
  <pre><code>WebDriverWait wait = new WebDriverWait(driver, 120);
  wait.until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("lblIPAddress")), "IP Address: 123.201.110.30"));
  </code></pre>
  
  <p>Even though I am able to get the text by <code>invisibilityOf()</code> method of the loader , once it get hidden then it span shows the IPAddress text.</p>
  
  <pre><code>wait.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div[@class='modal12']"))));
  System.out.println("IP address After wait = "+ driver.findElement(By.id("lblIPAddress")).getText());
  </code></pre>
  
  <p>But my query is to use condition in Explicit wait where it wait for the given time to check the condition (check weather text is available in the element or not). </p>
  
  <p>This is the code :</p>
  
  <pre><code>public static void main(String args[])
  {
  
      System.setProperty("webdriver.chrome.driver", "D:\\Application\\chromedriver.exe");
      driver = new ChromeDriver(); 
      driver.manage().window().maximize();
      driver.get("https://www.aspsnippets.com/demos/1331/");
      driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
      driver.findElement(By.id("btnGet")).click();
      System.out.println(driver.findElement(By.id("lblIPAddress")).getText().length());
      System.out.println("IP Address = "+ driver.findElement(By.id("lblIPAddress")).getText());       
      WebDriverWait wait = new WebDriverWait(driver, 120);
      wait.until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("lblIPAddress")), "IP Address: 123.201.110.30"));
      System.out.println("IP address After wait = "+ driver.findElement(By.id("lblIPAddress")).getText());
  
  }
  </code></pre>