Skip to content

Instantly share code, notes, and snippets.

Created March 5, 2018 13:35
Show Gist options
  • Save anonymous/89a84dbc15ba4088719400be1f359045 to your computer and use it in GitHub Desktop.
Save anonymous/89a84dbc15ba4088719400be1f359045 to your computer and use it in GitHub Desktop.
const {Builder, By, Key, until, assert} = require('selenium-webdriver');
let driver = new Builder()
.forBrowser('chrome')
.build();
driver.get('http://mujomusic.net/WDV321/Selenium/index.html')
.then(_ =>
driver.getTitle().then(function(title) {
var expectedTitle = "Selenium Form Test";
var actualTitle = driver.getTitle();
if(expectedTitle === title){
console.log("Title is Correct");
}
else{
console.log("Title is Wrong");
}
}))
.then(_ =>
driver.findElement(By.id('quantityInput')).sendKeys('-5', Key.TAB))
.then(_ =>
driver.findElement(By.name('submit')).click())
.then(_ =>
driver.findElement(By.id('quantityInput')).clear())
.then(_ =>
driver.findElement(By.id('quantityInput')).sendKeys('0', Key.TAB))
.then(_ =>
driver.findElement(By.name('submit')).click())
.then(_ =>
driver.findElement(By.id('quantityInput')).clear())
.then(_ =>
driver.findElement(By.id('quantityInput')).sendKeys('56', Key.TAB))
.then(_ =>
driver.findElement(By.name('submit')).click())
.then(_ =>
driver.findElement(By.id('quantityInput')).clear())
.then(_ =>
driver.findElement(By.id('quantityInput')).sendKeys('100', Key.TAB))
.then(_ =>
driver.findElement(By.name('submit')).click())
.then(_ =>
driver.findElement(By.id('quantityInput')).clear())
.then(_ =>
driver.findElement(By.id('quantityInput')).sendKeys('106', Key.TAB))
.then(_ =>
driver.findElement(By.name('submit')).click())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment