@@ -0,0 +1,2675 @@
+import org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.openqa.selenium.By;%0Aimport org.openqa.selenium.WebDriver;%0Aimport org.openqa.selenium.WebElement;%0Aimport org.openqa.selenium.chrome.ChromeDriver;%0Aimport org.openqa.selenium.support.ui.WebDriverWait;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.NoSuchElementException;%0Aimport java.util.concurrent.TimeUnit;%0A%0Aimport static junit.framework.TestCase.assertTrue;%0Aimport static org.openqa.selenium.support.ui.ExpectedConditions.attributeToBe;%0Aimport static org.openqa.selenium.support.ui.ExpectedConditions.stalenessOf;%0Aimport static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;%0A%0Apublic class task13 %7B%0A    private WebDriver driver;%0A    private WebDriverWait wait;%0A%0A    @Before%0A    public void start()%7B%0A        driver = new ChromeDriver();%0A        wait = new WebDriverWait(driver, 3);%0A    %7D%0A%0A    @Test%0A    public void basket()%7B%0A        driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);%0A        driver.get(%22http://localhost/litecart/en/%22);%0A        WebElement basketContent;%0A%0A        for (int i = 0; i %3C 3 ; i++) %7B%0A            addToBasket(i);%0A            basketContent = driver.findElement(By.cssSelector(%22#cart .quantity%22));%0A            wait.until(attributeToBe(basketContent,%22innerText%22, Integer.toString(i+1)));%0A            driver.findElement(By.className(%22general-0%22)).click();%0A        %7D%0A%0A        driver.findElement(By.cssSelector(%22#cart a.link%22)).click();%0A        WebElement removeButton;%0A        WebElement paymentDue;%0A%0A        for (int i = 0; i %3C 3; i++) %7B%0A            try %7B%0A                paymentDue = driver.findElement(By.cssSelector(%22.footer%22));%0A            %7D%0A            catch (org.openqa.selenium.NoSuchElementException e)%7B%0A                break;%0A            %7D%0A            removeButton =  driver.findElement(By.name(%22remove_cart_item%22));%0A            removeButton.click();%0A            wait.until(stalenessOf(paymentDue));%0A        %7D%0A    %7D%0A%0A    void addToBasket(int n)%7B%0A        List%3CWebElement%3E products;%0A        products = driver.findElements(By.cssSelector(%22ul.listing-wrapper .image-wrapper%22));%0A        products.get(n).click();%0A%0A        try %7B%0A            WebElement size = driver.findElement(By.name(%22options%5BSize%5D%22));%0A            size.click();%0A            size.findElement(By.cssSelector(%22%5Bvalue = Small%5D%22)).click();%0A            driver.findElement(By.name(%22add_cart_product%22)).click();%0A        %7D%0A        catch (org.openqa.selenium.NoSuchElementException e) %7B%0A            driver.findElement(By.name(%22add_cart_product%22)).click();%0A        %7D%0A    %7D%0A%0A    @After%0A    public void stop()%7B%0A        driver.quit();%0A        driver = null;%0A%7D%0A%7D%0A

task13