n1k0/casperjs — pull request #948 by botandrose (2014-06-12 19:10:01+00:00)
Title: Introduce fillLabels method to fill out a form based on label text.

Hi folks! I've begun using it to write acceptance tests, and its a much better tool for this purpose than all the others that I've tried in JavaScript-land. So, thank you for CasperJS!

So, from the standpoint of using CasperJS as a tool to write acceptance tests, I have found one area for improvement. The problem is that the methods for interacting with forms and form elements require direct knowledge of the underlying html, specifically the name attribute of the inputs. Since acceptance tests are written from the standpoint of a non-technical user, and non-technical users don't know anything about html, css selectors, etc; associated label text is a better way of calling out form elements. This strategy also reduces the coupling between the acceptance test and the app, promoting refactoring of the html and css.

This branch is an attempt at adding this behavior to CasperJS, in the form of new fillLabels method. What do you guys think?