kosher supports most common HTML field types.
- Buttons and Hyperlinks
- Text-based Fields
- File Fields
- Checkbox Fields
- Radio Button Fields
- Select Fields
- 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.
<input type="button" /> <input type="reset" /> <input type="submit" /> <button></button>
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 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" />
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.
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" />
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" />
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>
window.alert('Hello, world!'); let doesAccept = window.confirm('Do you accept?'); let firstName = window.prompt('Enter your first name:');