When I fill in "value" for "field" by its attribute

This step definition describes entering a specific value into a particular field on the website being tested.

When (I|we)* fill in "([^"]*)?" for "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)

 

This step is usually used when a specific input text field needs to be filled with a particular value to perform an event whose results depend on the entered value.

 

This field can be specified by id | class | name | placeholder for the field. It is possible to add or not add a sign “.” for class, and "#" for id.

 

Example by direct calling of ID, class:

When I fill in "Jhon Smith" for "#username" by attribute
When I fill in "Jhon Smith" for ".username" by attr

 

Or match any of the field attributes:

When I fill in "Jhon Smith" for "username" by attr
When I fill in "Jhon Smith" for "username" by its "name" attr
When I fill in "Jhon Smith" for "username" by its "placeholder" attribute