code: public function choseOptionFromAutocompleteVariants($value, $selector, $option)
      {
          if (!$option) {
              throw new \InvalidArgumentException(sprintf(
                  'An option that will be chosen expected as positive number, but was got the: %s',
                  $option
              ));
          }
  
          $field = $this->element('field', $selector);
          // Syn - a Standalone Synthetic Event Library, provided by Selenium.
          $this->executeJsOnElement($field, sprintf("Syn.type({{ELEMENT}}, '%s')", token_replace($value)));
          $this->waitAjaxAndAnimations();
  
          $autocomplete = $field->getParent()->findById('autocomplete');
          $this->throwNoSuchElementException('#autocomplete', $autocomplete);
  
          $options = count($autocomplete->findAll('css', 'li'));
  
          if ($options < 1) {
              throw new \RuntimeException('Neither option was not loaded.');
          }
  
          if ($option > $options) {
              throw new \OverflowException(sprintf(
                  'You can not select an option %s, as there are only %d.',
                  $option,
                  $options
              ));
          }
  
          for ($i = 0; $i < $option; $i++) {
              // 40 - down
              $field->keyDown(40);
              $field->keyUp(40);
          }
  
          // 13 - return
          $field->keyDown(13);
          $field->keyUp(13);
  
          if ($field->getValue() == $value) {
              throw new \Exception(sprintf('The value of "%s" field was not changed.', $selector));
          }
      }
docs: @param string $value
  Typed text.
  @param string $selector
  Selector of the field.
  @param int $option
  An option number. Will be selected from loaded variants.
  
  @throws \InvalidArgumentException
  When $option is less than zero.
  @throws NoSuchElement
  When autocomplete list was not loaded.
  @throws \RuntimeException
  When neither option was not loaded.
  @throws \OverflowException
  When $option is more than variants are available.
  @throws \Exception
  When value was not changed.
  
  @Then /^(?:|I )typed "([^"]*)" in the "([^"]*)" field and chose (\d+) option from autocomplete variants$/