public function VarbaseContext::iClickOnTheRadioLabelForValue in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.8
Same name and namespace in other branches
- 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()
- 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheRadioLabelForValue()
- 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheRadioLabelForValue()
Click on the label with the for attribute value.
Linked 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. Varbase Context #varbase.
Example #1: Given I click on the radio label for "right_sidebar_layout" value Example #2: When I click on the radio label for "layout-settings" value
@Given /^I click on the radio label for "([^"]*)" value$/
File
- tests/
features/ bootstrap/ VarbaseContext.php, line 1442
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.");
}
}