nightwatch in selenium

import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class GroceryStoreTest { public static void main(String[] args) { // Set ChromeDriver path…

Continue Readingnightwatch in selenium

Selenium + Cucumber

In the file SeleniumTest.java add the below code @Test(priority =1) public void CheckIframes1() throws Exception{ // write your code here driver.switchTo().frame(driver.findElement(By.id(id:iframe1"))); driver.switchTo().frame(driver.findElement(By.id(id:iframe2"))); driver.findElement(By.xpath(xpathExpression:"button[@class='button+1']")).click(); String coupon = driver.findElement(By.xpath(xpathExpression:"button[@class='button-1']")).getText(); } @Test(priority =2)…

Continue ReadingSelenium + Cucumber

Nightwatch

In the file App test.js add the below code module.exports= { "Grocery Store": function(browser) { browser .url("https://localhost:8000") .assert.urlContains(http://localhost:8000") .assert.titleContains("Grocery Store") .elements("xpath","//figcaption/button",function(result) { console.log(result.value.length) for (var i=1; i<=result.value.length;i++0 { browser.useXpath() browser.click("(//figcaption/button)["+i+"]")…

Continue ReadingNightwatch