public function setOwner($owner) { $this->owner->click(); $this->waitForAjax(); $this->test->byXpath("//div[@id='select2-drop']/div/input")->value($owner); $this->waitForAjax(); $this->assertElementPresent("//div[@id='select2-drop']//div[contains(., '{$owner}')]", "Owner autocomplete doesn't return search value"); $this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$owner}')]")->click(); return $this; }