'How can an element be grabbed with codeception?

Let's say we have the following HTML code:

<div>
  <p id="fruit">Apple</p>
</div>

How do I grab #fruit and check its inner HTML via codeception?



Solution 1:[1]

$fruitVal = $I->grabAttributeFrom('#fruit', 'innerHTML');

No longer works.

Use this instead:

$fruitVal = $I->grabTextFrom('#fruit');

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alex Lomia