Link

Supported Field Types

kosher supports most common HTML field types.

Field Types

  1. Buttons and Hyperlinks
    1. Button Elements
    2. Hyperlink Elements
  2. Text-based Fields
  3. File Fields
  4. Checkbox Fields
  5. Radio Button Fields
  6. Select Fields
  7. Browser Pop-ups

Most steps that support clicking/pressing buttons also support hyperlinks. Additionally, unless otherwise stated, these steps support pressing/clicking any element visible on the screen.

Button Elements

<input type="button" />
<input type="reset" />
<input type="submit" />
<button></button>
<a href="#"></a>

Text-based Fields

kosher supports interacting with all text-based HTML fields. Examples of those follow:

<input type="date" />
<input type="datetime-local" />
<input type="email" />
<input type="month" />
<input type="number" />
<input type="password" />
<input type="search" />
<input type="tel" />
<input type="time" />
<input type="url" />
<input type="week" />
<textarea></textarea>
<input type="text" />

File Fields

File input fields are supported. Often, these may not be visible on the screen due to attractive styling performed by UI packages such as Boostrap. Nonetheless, kosher can still interact with the field.

<input type="file" name="file-uploader" />

IMPORTANT INFORMATION!!!

When validating the value of a file field, you might be surprised to find the browser replaces the original file path with C:\fakepath\<the original filename>. This is a security feature of most browsers. If you would like to learn more, please visit https://davidwalsh.name/fakepath.

Checkbox Fields

Some steps allow checking or un-checking checkbox fields. For the purposes of kosher, checkbox fields must actually be an HTML checkbox element:

<input type="checkbox" name="favorite_colors_green" />
<input type="checkbox" name="favorite_colors_red" />

Radio Button Fields

kosher allows selecting a value from a group of radio buttons linked together by a common name value. Again, with kosher, the radio button fields must actually be an HTML radio button element:

<input type="radio" name="favorite_colors" value="green" />
<input type="radio" name="favorite_colors" value="red" />

Select Fields

Some step definitions enable interactions with select lists. As with the above types, these must actuall be HTML select elements. Pay careful attention to the documentation for these step definitions, as some restrict their applicability to select lists with the multiple attribute set.

<select name="state">
    <option value="al">Alabama</option>
    <option value="ak">Alaska</option>
    <option value="ar">Arkansas</option>
</select>

<select name="favorite_colors" size="2" multiple>
    <option value="green">Green</option>
    <option value="red">Red</option>
</select>

Browser Pop-ups

kosher also provides capabilities for manipulating browser prompts (alerts, confirmations, and prompts). These type of pop-ups are generated via JavaScript commands such as the following:

window.alert('Hello, world!');

let doesAccept = window.confirm('Do you accept?');

let firstName = window.prompt('Enter your first name:');