When I select "option" from "select list" by attribute

This step definition acts as a command to select an option from a dropdown list.

When (I|we)* select "([^"]*)?" from "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)

Define the step for selecting an option by its text in the select element specified by ID, class, name, or any other attribute.

 

Example by direct calling of ID, class:

When I select "Mercedes" from "#cars"by attr
When I select "Mercedes" from ".cars" by attribute

 

Or match any of the field attributes:

When we select "Mercedes" from "cars" by its "id" attribute
When we select "Saab" from "cars" by its "name" attr
When we select "Mercedes" from "cars" by attr