Skip to content

Commit 7d9a477

Browse files
committed
Add Select in Chosen Selector function
1 parent 6293453 commit 7d9a477

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/JoomlaBrowser.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,24 @@ public function checkForPhpNoticesOrWarnings($page = null)
217217
$I->dontSeeInPageSource('Notice:');
218218
$I->dontSeeInPageSource('Warning:');
219219
}
220+
221+
/**
222+
* Selects an option in a Chosen Selector based on its label
223+
*
224+
* @return void
225+
*/
226+
public function selectOptionInChosen($label, $option)
227+
{
228+
$select = $this->findField($label);
229+
$this->debug($select);
230+
$selectID = $select->getAttribute('id');
231+
$this->debug($selectID);
232+
$chosenSelectID = $selectID . '_chzn';
233+
$this->debug($chosenSelectID);
234+
$I = $this;
235+
$this->debug("I open the $label chosen selector");
236+
$I->click(['xpath' => "//div[@id='$chosenSelectID']/a/div/b"]);
237+
$this->debug("I select $option");
238+
$I->click(['xpath' => "//div[@id='$chosenSelectID']//li[text()='$option']"]);
239+
}
220240
}

0 commit comments

Comments
 (0)