public function VarbaseContext::iClickOnTheRadioLabelForValue in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.7
Same name and namespace in other branches
- 8.8 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheRadioLabelForValue()
- 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheRadioLabelForValue()
- 8.5 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheRadioLabelForValue()
- 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheRadioLabelForValue()
- 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheRadioLabelForValue()
#varbase: To click on the label with the for attribute value linked to to the an ID of a radio button with a value to select the radio option we need to use this when we do have a list of radio buttons but we do have the label with extra HTML tags like images or the actual radio button is hidden.
Example 1: I click on the radio label for "right_sidebar_layout" value
@Given /^I click on the radio label for "([^"]*)" value$/
File
- tests/
features/ bootstrap/ VarbaseContext.php, line 1334
Class
- VarbaseContext
- Defines application features from the specific context.
Code
public function iClickOnTheRadioLabelForValue($value) {
$radio_label = $this
->getSession()
->getPage()
->find('xpath', "//label[contains(@for, '{$value}')]");
if ($radio_label) {
$radio_label
->click();
}
else {
throw new \Exception("No label with the value of for='" . $value . "' radio button not found.");
}
}