public function VarbaseContext::iClickOnTheImageWithTheAltText 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::iClickOnTheImageWithTheAltText()
- 8.5 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheImageWithTheAltText()
- 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheImageWithTheAltText()
- 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheImageWithTheAltText()
- 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnTheImageWithTheAltText()
Click on an image with the provided alt.
Varbase Context #varbase.
Example 1: I click on the image with the "Flag Earth image title" alt text.
@Given /^I click on the image with the "([^"]*)" alt text$/
File
- tests/
features/ bootstrap/ VarbaseContext.php, line 771
Class
- VarbaseContext
- Defines application features from the specific context.
Code
public function iClickOnTheImageWithTheAltText($altText) {
// Find an image with the title.
$element = $this
->getSession()
->getPage()
->find('xpath', "//img[contains(@title, '{$altText}')]");
if (empty($element)) {
throw new \Exception('The page dose not have an image with the [ ' . $altText . ' ] title text.');
}
// Click on the image.
$element
->click();
}