TestNG for groupon.com
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import
org.openqa.selenium.firefox.FirefoxDriver;
import
org.testng.annotations.AfterClass;
import
org.testng.annotations.AfterMethod;
import
org.testng.annotations.BeforeClass;
import
org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class
testngggggggggggggggggggggggggggggroupon {
static WebDriver wd;
@BeforeClass
public void invoke(){
wd=new FirefoxDriver();
}
@AfterClass
public void close(){
wd.close();
}
@BeforeMethod
public void login() throws InterruptedException{
wd.get("http:groupon.com");
wd.findElement(By.xpath(".//*[@id='ls-user-signin']")).click();
Thread.sleep(5000l);
wd.findElement(By.xpath(".//*[@id='email-input']")).sendKeys("akhilreddytech@gmail.com");
wd.findElement(By.xpath(".//*[@id='password-input']")).sendKeys("akhil2994");
wd.findElement(By.xpath(".//*[@id='signin-button']")).click();
}
@AfterMethod
public void logout() throws InterruptedException, IOException{
Thread.sleep(3000l);
Properties p =new Properties();
FileInputStream fis=new FileInputStream("C:\\Documents and
Settings\\akki\\workspaceaaaa1\\juuuuuuuuuuuuuuuuunit\\src\\akki");
p.load(fis);
wd.findElement(By.id(p.getProperty("a"))).click();
Thread.sleep(3000l);
wd.findElement(By.xpath(".//*[@id='sign-out']")).click();
}
@Test(priority=1)
public void home(){
wd.findElement(By.xpath(".//*[@id='sls-aria-1']/span")).click();
//wd.findElement(By.xpath(".//*[@id='left-nav-categories']/ul/li[10]/a/div")).click();
}
@Test(priority=0)
public void local() throws InterruptedException{
System.out.println("hi");
wd.findElement(By.xpath(".//*[@id='sls-aria-2']")).click();
wd.findElement(By.xpath(".//*[@id='pull-static-map-wrapper']/div[1]/div[2]/div[2]")).click();
wd.findElement(By.xpath(".//*[@id='user-name']")).click();
Thread.sleep(3000l);
wd.findElement(By.xpath(".//*[@id='sign-out']")).click();
}
@Test(enabled=false)
public void goods(){
wd.findElement(By.xpath("")).click();
}
@Test(enabled=false)
public void coupons(){
wd.findElement(By.xpath("")).click();
}
}
Thanks for the great information in your blog Appium Training in Chennai
ReplyDelete