/** * Select2Select is for select data from select2 dropdown menu via fill input field * @param string $id * @param string $value */ public function Select2Select($id, $value) { $nonHashmarkId = substr($id, 1); $this->seeElement($id . ' + .select2'); $this->executeJS('$("' . $id . ' + .select2 .select2-selection").trigger({type: "mousedown", which: 1})'); $this->waitForElementVisible('//*[@id="select2-' . $nonHashmarkId . '-results"]', 5); // SELECT2 Search input field $this->fillField('body > .select2-container .select2-search__field', $value); $this->waitForText($value, 5, '//*[@id="select2-' . $nonHashmarkId . '-results"]'); $this->pressKey('body > .select2-container .select2-search__field', \WebDriverKeys::ENTER); $this->see($value, $id . ' + .select2-container .select2-selection__rendered'); }