How to fetch Value from element in MFTF(Magento Functional Testing Framework) Using Codeception.
1.) How to fetch value from element used for assertion.
Suppose if you want to take data from element and that data you want to use for assertion .
Then You can use following Syntax for this.
<grabMultiple selector=”Here write CSS Selctor of the element” stepKey=”grabProducts”/>
Here “grabProducts” used as a variable. That can be Used in Actual Result.
<assertContains stepKey=”assertContains”>
<expectedResult type=”string”>Here Write your expected Result</expectedResult>
<actualResult type=”variable”>grabProducts</actualResult>
</assertContains>
<expectedResult type it depends on variable which type of data are you using.
Suppose you are using DIGIT or Count then you can use like
<expectedResult type=”int”>12</expectedResult>
2.) How to fetch value from element used for DATA.
If you want grab or fetch value from element and then want use for Fill the Form.
There is a simple syntax for that
<grabValueFrom selector=”Here write CSS Selctor of the element” stepKey=”grabProducts”/>
Here “grabProducts” used as a variable.
<fillField userInput=”{$grabProducts}” selector=”{{SectionName.elementName}}” stepKey=”FillgrabProductVariableData”/>
