title: Selenium webdriver can't find element sometimes
body: <p>I'm trying to find the search box on tripadvisor but <strong>sometimes</strong> it is not able to find it. (I get timeout error). I have added WebDriverWait and time.sleep but to no avail. I am still in the midst of testing so there is a part of my code requiring human intervention below.</p>
  <p>Edit: Changing to time.sleep(10) instead of 5 seconds helps. But it makes the code very slow. Hoping to use WebDriverWait instead...</p>
  <pre><code>searchbox = WebDriverWait(driver,20).until(EC.presence_of_element_located((By.XPATH, &quot;//input[@placeholder='Where to?']&quot;)))
  </code></pre>
  <p>Below is my full code, where I have to find the searchbox multiple times for each country.</p>
  <pre><code>from selenium.webdriver.common.by import By
  from selenium import webdriver 
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  import time
  
  driver = webdriver.Chrome(executable_path=r'C:\\Users\\user\\Downloads\\chromedriver.exe') 
  driver.get(&quot;https://www.tripadvisor.com.sg/Hotels-g293951-Malaysia-Hotels.html&quot;)
  </code></pre>
  <p>Human intervention here: Click on a random check-in date, check-out date and then click &quot;Update&quot;</p>
  <pre><code>countries3 = [&quot;France&quot;,&quot;Qatar&quot;,&quot;Brunei Darussalam&quot;,&quot;Hong Kong&quot;]
  countries4 = [&quot;Germany&quot;,&quot;The Netherlands&quot;,&quot;Nigeria&quot;,&quot;South Africa&quot;,&quot;Russia&quot;]
  countries2 = [&quot;New York&quot;,&quot;Saudi Arabia&quot;,&quot;Sri Lanka&quot;,&quot;Switzerland&quot;,&quot;Turkey&quot;]
  countries1 = [&quot;United Arab Emirates&quot;,&quot;New Zealand&quot;,&quot;Thailand&quot;,&quot;India&quot;]
  countries5 = [&quot;Vietnam&quot;,&quot;Australia&quot;,&quot;Malaysia&quot;,&quot;Cambodia&quot;,&quot;Indonesia&quot;,&quot;Laos&quot;,&quot;Myanmar&quot;,&quot;Philippines&quot;,&quot;Thailand&quot;,&quot;Vietnam&quot;,&quot;Australia&quot;,             &quot;Canada&quot;,&quot;China&quot;,&quot;Japan&quot;,&quot;Taiwan&quot;,&quot;United Kingdom&quot;,&quot;United States&quot;,&quot;Bangladesh&quot;,&quot;Belgium&quot;,&quot;Egypt&quot;,&quot;Finland&quot;]
  countries = countries1+countries2+countries3+countries4+countries5
  
  for country in countries: 
      driver.get(URL)
      driver.implicitly_wait(10)
      time.sleep(5)
      searchbox = WebDriverWait(driver,20).until(EC.presence_of_element_located((By.XPATH, &quot;//input[@placeholder='Where to?']&quot;)))
      searchbox.send_keys(country) #select your destination here 
      time.sleep(2)
      possible = driver.find_elements_by_class_name(&quot;_3a_rGDNB&quot;)
      for i in possible:
          if i.text == country:
              i.click()
              break
              
      time.sleep(5)
  
      hotels = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, '//*[@title=&quot;Hotels&quot;]')))
      driver.execute_script(&quot;arguments[0].click();&quot;, hotels)
      time.sleep(3)
  
  </code></pre>