title: Explicit wait for Selenium Webdriver
body: <p>Working on the method trying to understand the explicit wait. </p>
  
  <pre><code>    require 'rubygems'
  require 'selenium-webdriver'
  require 'cucumber'
  
  $driver = Selenium::WebDriver.for :firefox
  $driver.manage.timeouts.implicit_wait = 3
  
      Then /^do search$/ do
    driver = $driver
    one_way = driver.find_element(:id, "search.ar.type.code.oneWay").click
      sleep 5
     from = driver.find_element :xpath =&gt; "//div[@class = 'origin column1']//input[@type = 'text']"
     from.click
  </code></pre>
  
  <p>So after <code>one_way</code> radio button is clicked and input form changed , so I put <code>sleep 5</code> to give it a time element to appear, otherwise would be error "element not visible ...". So I thought it would be good time to understand explicit wait, because I need to wait till element will appear.</p>
  
  <pre><code>    wait = Selenium::WebDriver::Wait.new(:timeout =&gt; 40)
    wait.until {from = driver.find_element(:xpath, "//div[@class = 'origin column1']//input[@type = 'text']")
    from.click
    }
  </code></pre>
  
  <p>But getting error "Selenium::WebDriver::Error::ElementNotVisibleError: Element is not currently visible and so may not be interacted with" . Why this code doesn't wait till element appears and click it? </p>