Skip to content

Instantly share code, notes, and snippets.

Last active March 9, 2018 14:10
What would you like to do?
function myFunc() {
var email = document.getElementById("email").value
var e = document.getElementById("select")
var selectedOption = e.options[e.selectedIndex].value
var checkBox = document.getElementById('defaultCheck1').checked
if (email == 'foo@bar' && checkBox && selectedOption == "audi") {
document.getElementById('button').innerText = "Sending..."
return false;
<form onsubmit="return myFunc()">
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" placeholder="">
<div class="form-group">
<label for="exampleFormControlSelect1">Example select</label>
<select id="select">
<option>Select an option</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
Default checkbox
<div class="form-group">
<label for="exampleFormControlTextarea1">Example textarea</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
<button type="submit" id="button" class="btn btn-primary">Send</button>
module.exports = {
'Show sending message just when default checkbox and Audi are selected': (browser) => {
.waitForElementVisible('body', 50)
.setValue("//*[contains(text(), 'Email address')]/following-sibling::input", 'foo@bar') // select input next to a label "Email address"
.click("//*[contains(text(), 'Default checkbox')]")
.click("//*[text()='Select an option']")
.expect.element("//*[contains(text(), 'Sending...')]")
Copy link


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment