title: Unable to Select option from dropdown using JavascrtptExecutor
body: <p>Can anyone provide me a failsafe(ish) method for selecting text from dropdowns on this page I am practicing on?  </p>
  
  <p><a href="https://www.club18-30.com/club18-30" rel="nofollow">https://www.club18-30.com/club18-30</a></p>
  
  <p>Specifically, the 'from' and 'to' airport dropdowns.  I am using the following code:</p>
  
  <pre><code>   public void selectWhereFrom(String query, String whereFromSelect) throws InterruptedException {
      WebElement dropDownContainer = driver.findElement(By.xpath(departureAirportLocator));
      dropDownContainer.click();
  
      selectOption(query,whereFromSelect);
  }
  
  public void selectOption(String query, String option) {
      String script =
              "function selectOption(s) {\r\n" +
                      "   var sel = document.querySelector(' " + query + "');\r\n" +
                      "   for (var i = 0; i &lt; sel.options.length; i++)\r\n" +
                      "   {\r\n" +
                      "       if (sel.options[i].text.indexOf(s) &gt; -1)\r\n" +
                      "       {\r\n" +
                      "           sel.options[i].selected = true;\r\n" +
                      "           break;\r\n" +
                      "       }\r\n" +
                      "   }\r\n" +
                      "}\r\n" +
                      "return selectOption('" + option + "');";
  
      javaScriptExecutor(script);
  }
  </code></pre>
  
  <p>This seems to successfully populate the box with text but when I hit 'Search' I then receive a message saying I need to select an option, suggesting it has not registered the selection? </p>
  
  <p>I would rather avoid JavaScriptExecutor but haven't been able to make these Selects work with a regular Selenium Select mechanism</p>