Reputation: 4946
I have some HTML
<tr data-automation="registerRow" ng-repeat="item in vm.registers | orderBy : 'name'" class="ng-scope">
<td data-automation="register-name" class="ng-binding">Lane 1</td>
<td data-automation="register-status" class="center capitalize ng-binding">Uncounted</td>
<td><div class="btn-group" role="group"><button type="button" class="btn btn-action" ng-click="vm.count()">Count</button></div></td>
</tr>
I'm able to count the number of rows
casper.test.assertElementCount('[data-automation="register-row"]', 2);
I would like to check the text of the of [data-automation="register-name"]
.
Does Casper wrap jquery or anything where I could do ('selector').text()
?
What Can I call in Casper to verify the [data-automation="register-name"] === "XXX"
Upvotes: 0
Views: 1990
Reputation: 41
there are two ways to achieve this:
Using the gethtml method, there is a really good example in the documentation: http://docs.casperjs.org/en/latest/modules/casper.html#gethtml
Or you can inject your js script into the page with the evaluate method, your script will run in the context of the page. You can easily use jquery to fetch the text!! Here is the link to the docs: http://docs.casperjs.org/en/latest/modules/casper.html#evaluate
And for testing you can use assertEquals(testValue, expected)
Upvotes: 1