Sei sulla pagina 1di 2

import java.util.concurrent.

TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.annotations.AfterClass;

public class JDsports {


protected static WebDriver wd;
protected static String result;
@BeforeClass
public static void setup()
{
wd = new FirefoxDriver();
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@Test
void Testcase1() {
wd.get("http://www.jdsports.co.uk/home");
Actions action = new Actions(wd);
WebElement mainMenu = wd.findElement(By.xpath("//a[contains(.,'NEW I
N')]"));;
action.moveToElement(mainMenu).moveToElement(wd.findElement(By.xpath
("//a[@manual_cm_re='top-nav-_-new-in-_-Men']"))).click().build().perform();
wd.findElement(By.xpath("//img[@title='Nike Air Huarache']")).click(
);
wd.findElement(By.xpath("//label[contains(.,'12')]")).click();
wd.findElement(By.xpath("//button[@id='addToBag']")).click();
wd.findElement(By.xpath("//button[@id='proceedToCheckout']")).click(
);
wd.findElement(By.xpath("//input[@name='logonId1']")).sendkeys("cp.k

runal@gmail.com");
wd.findElement(By.xpath("//input[@id='uk-standard']")).click();
wd.findElement(By.xpath("//input[@id='delivery_first_name']")).sendk
eys("tset");
wd.findElement(By.xpath("//input[@id='delivery_last_name']")).sendke
ys("tset demo");
wd.findElement(By.xpath("//input[@id='delivery_contact_number']")).s
endkeys("+442071234567");
wd.findElement(By.xpath("//input[@id='delivery_postcode_lookup']")).
sendkeys("DY11YJ");
wd.findElement(By.xpath("//button[@id='delivery_find_address_1']")).
click();
WebElement element=wd.findElement(By.id("delivery_select_address));
Select se=new Select(element);
se.selectByVisibleText("3 Brentfield Road, DARTFORD DA1 1YJ");
wd.findElement(By.xpath("//button[@id='delivery_select_address_1']")
).click();
wd.findElement(By.xpath("//button[@id='forScroll']")).click();
wd.findElement(By.xpath("//input[@id='same_billing_delivery']")).cli
ck();
wd.findElement(By.xpath("//button[@class='primary icon']")).click();
wd.findElement(By.xpath("//input[@id='pay_pal']")).click();
wd.findElement(By.xpath("//button[@id='buttonForPaypalSubmit']")).cl
ick();
}
@AfterClass
public static void teardown()
{
wd.close();
wd.quit();
}
}

Potrebbero piacerti anche