Practice form

This is a sample web form to help you practice creating auto click / auto fill rules for all the different types of form fields that supports. You can identify the field to automatically fill by entering a supported xpath value into the xpath column.

Basic XPath

Form Field HTML XPath
<input type="text" />
  • //input[@type="text"]
<input name="username"/>
  • //input[@name="username"]
<input placeholder="First name"/>
  • //input[@placeholder="First name"]
<input id="last-name"/>
  • //input[@id="last-name"]
<input aria-describedby="name"/>
  • //input[@aria-describedby="name"]
<input readonly/>
  • //input[@readonly]
<input disabled/>
  • //input[@disabled]
<input type="email"/>
  • //input[@type="email"]
<input type="password"/>
  • //input[@type="password"]
link
<a href="#" target="_blank">link</a>
  • //a[@href]
  • //a[@href="#"]
  • //a[@target="_blank"]
  • //a[text()="link"]
Male
Female
Other
<input type="radio" name="gender" value="male" checked> Male
<input type="radio" name="gender" value="female"> Female
<input type="radio" name="gender" value="other"> Other
  • //input[@type="radio"]
  • //input[@name="gender"]
  • //input[@value="other"]
<select name="cars">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="fiat">Fiat</option>
  <option value="audi">Audi</option>
</select>
  • //select[@name="cars"]
values
  • volvo
  • saab
  • fiat
  • audi
<textarea name="message" rows="3" cols="30">
  The cat was playing in the garden.
</textarea>
  • //textarea[@name="message"]
  • //textarea[@rows="3"]
  • //textarea[@cols="30"]
<input type="submit" value="Submit">
  • //input[@type="submit"]
  • //input[@value="Submit"]
I have a bike
I have a car
I have a boat
<input type="checkbox" name="vehicle1" value="Bike"> I have a bike
<input type="checkbox" name="vehicle2" value="Car"> I have a car
<input type="checkbox" name="vehicle3" value="Boat" checked> I have a boat
  • //input[@type="checkbox"]
  • //input[@name="vehicle2"]
  • //input[@value="Car"]
  • //input[@checked]
<button type="button" onclick="alert('Hello World!')">Click Me!</button>
  • //button[@type="button"]
  • //button[@onclick]

Advance XPath

Contains()

Element HTML XPath
<input type="submit" />
  • //input[contains(@type,"submit")]
  • //input[contains(@type,"sub")]
  • //*[contains(@type,"mit")]
<button type="button" name="btnLogin">Login</button>
  • //button[contains(@name,"btn")]
  • //button[contains(text(),"Log")]
  • //*[contains(@type,"button")]
Please enter your shipping address.
<label for="address">Address</label>
<input type="text" class="form-control is-invalid" id="address">
<div class="invalid-feedback">
 Please enter your shipping address.
</div>
label
  • //label[@for="address"]
  • //label[contains(text(),"Address")]
div
  • //*[@class="invalid-feedback"]
  • //div[contains(@class,"invalid")]
<button type="button" class="btn-primary">Primary</button>
<button type="button" class="btn-secondary">Secondary</button>
<button type="button" class="btn-success">Success</button>
<button type="button" class="btn-danger">Danger</button>
<button type="button" class="btn-warning">Warning</button>
<button type="button" class="btn-info">Info</button>
<button type="button" class="btn-light">Light</button>
<button type="button" class="btn-dark">Dark</button>
Select All
  • //button
  • //button[@type="button"]
  • //*[contains(@class,"btn-")]

Using OR & AND

Element HTML XPath
<form class="form-signin">
  <label for="inputEmail">Email address</label>
  <input type="email" id="inputEmail" placeholder="Email address" >
  <label for="inputPassword">Password</label>
  <input type="password" id="inputPassword" placeholder="Password" >
</form>
  • //form/input[@type="email" or @type="password"]
  • //form/input[@type="email" and @id="inputEmail"]
  • //form/input[@type="email" and @id]
  • //form[@class="form-signin"]/input[@id="inputPassword"]
  • //form[@class="form-signin"]/input[1]
  • //form[@class="form-signin"]/input[2]

starts-with(@attribute,value)

Element HTML XPath
<button type="button" class="btn-primary">Primary</button>
<button type="button" class="btn-secondary">Secondary</button>
<button type="button" class="btn-success">Success</button>
<button type="button" class="btn-danger">Danger</button>
<button type="button" class="btn-warning">Warning</button>
<button type="button" class="btn-info">Info</button>
<button type="button" class="btn-light">Light</button>
<button type="button" class="btn-dark">Dark</button>
  • //button[starts-with(@class,"btn")]