Cannot work my element visible in Selenium
<p>I'm writing a selenium script using java. </p>

<p>In my scenario, I have a select button and a OK button. Select button is enabled and OK button is disabled when I first loaded the page. When I click on select button, a pop-up window appears. </p>

<p>Then I select a date from a date picker in the pop-up window. After selecting the date I click confirm button in the pop-up window. After click on confirm button the pop-up window closes and Book Now button enables. </p>

<p>This is my test scenario. But, when I run this my test fails at the point of clicking the Book Now button.</p>

<p>So, I used <code>FluentWait</code> to recover this. But, when I'm running my code it just ignores the FluentWait part and run the code.</p>

<p>Can anyone tell me how to click OK button using my script.</p>

<p>Here is my code.</p>

<pre><code>// Select Days
driver.findElement(By.xpath("//div[@id='myModal0']/div/div/div[2]/div/div[2]/div/div/input")).click();
driver.findElement(By.xpath("//div[@id='ui-datepicker-div']/table/tbody/tr[3]/td[5]/a")).click(); 
System.out.println("User Selected the days the service is offered");

Thread.sleep(4000);

// Click Confirm Button
driver.findElement(By.xpath("//div[@id='myModal0']/div/div/div[2]/div/div[6]/button")).click(); 
System.out.println("User clicked Confirm Button");

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

// Click Book Now Button
//driver.findElement(By.xpath("//tr[@id='0']/td[6]/button")).click();
//System.out.println("User Clicked Book Now Button");   


System.out.println("aaaaaaaaaa");

class CheckForFoo implements Function&lt;WebDriver,WebElement&gt; {
    @override
    public WebElement apply(WebDriver driver) {
          return driver.findElement(By.xpath("//tr[@id='0']/td[6]/button"));
    }
}

FluentWait&lt;WebDriver&gt; wait = new FluentWait&lt;WebDriver&gt;(driver)    
     .withTimeout(30, TimeUnit.SECONDS)    
     .pollingEvery(5, TimeUnit.SECONDS)   
     .ignoring(NoSuchElementException.class);

WebElement foo = (WebElement) wait.until(new CheckForFoo());

System.out.println("bbbbbbbbbb");
</code></pre>

<p>Thanks in advance. :)</p>

<ul>
<li>edit - </li>
</ul>

<p>Before I used FluentWait I got the following error.</p>

<blockquote>
  <p>Exception in thread "main" org.openqa.selenium.WebDriverException: Element is not clickable at point (1460.7666015625, 159.03334045410156). Other element would receive the click: 
  Command duration or timeout: 84 milliseconds
  Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
  System info: host: 'ET_LAHIRU', ip: '192.168.1.4', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=45.0.1, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
  Session ID: 16e51961-3d8c-4c31-9dec-547d04235eac
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
      at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)
      at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:85)
      at selrcdemo.Activities.activities(Activities.java:97)
      at selrcdemo.ayubomain.main(ayubomain.java:69)</p>
</blockquote>

<p>But, after adding FluentWait no errors. But, it doesn't do what I want. :)</p>