Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/JoomlaBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ public function selectOptionInRadioField($label, $option)
/**
* Selects an option in a Chosen Selector based on its label
*
* @param string $label The text in the <label> with for attribute that links to the <select> element
* @param string $option The text in the <option> to be selected in the chosen selector
*
* @return void
*/
public function selectOptionInChosen($label, $option)
Expand All @@ -424,6 +427,25 @@ public function selectOptionInChosen($label, $option)
$I->wait(1); // Gives time to chosen to close
}

/**
* Selects an option in a Chosen Selector based on its label
*
* @param string $selectId The id of the <select> element
* @param string $option The text in the <option> to be selected in the chosen selector
*
* @return void
*/
public function selectOptionInChosenById($selectId, $option)
{
$chosenSelectID = $selectId . '_chzn';
$I = $this;
$this->debug("I open the $chosenSelectID chosen selector");
$I->click(['xpath' => "//div[@id='$chosenSelectID']/a/div/b"]);
$this->debug("I select $option");
$I->click(['xpath' => "//div[@id='$chosenSelectID']//li[text()='$option']"]);
$I->wait(1); // Gives time to chosen to close
}

/**
* Selects one or more options in a Chosen Multiple Select based on its label
*
Expand Down