Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.83 KB | None | 0 0
  1. import org.openqa.selenium.By;
  2. import org.openqa.selenium.WebDriver;
  3. import org.testng.Assert;
  4. import org.testng.annotations.BeforeTest;
  5. import org.testng.annotations.Test;
  6. import org.openqa.selenium.firefox.FirefoxDriver;
  7.  
  8. import java.util.concurrent.TimeUnit;
  9.  
  10. public class addNewWordToDictionary {
  11.  
  12.     protected static WebDriver driver;
  13.  
  14.     @BeforeTest
  15.     public void startChrome() {
  16.         System.setProperty("webdriver.gecko.driver", "/Users/macbook/Downloads/SampleUITests/drivers/geckodriver-18.0-mac");
  17.         driver = new FirefoxDriver();
  18.  
  19.         driver.manage().window().maximize();
  20.         driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
  21.     }
  22.  
  23.  
  24.     @Test(priority = 1, description = "Successful login into Lingualeo")
  25.     public void SuccessfulLoginToLinguaLeo() {
  26.         driver.get("https://lingualeo.com/ru/login");
  27.         driver.findElement(By.xpath("//*[@id=\"email\"]")).sendKeys("adikalova@gmail.com");
  28.         driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("A771d6552");
  29.         driver.findElement(By.xpath("/html/body/div[1]/div[2]/div/div[1]/div[3]/form/input[4]")).click();
  30.  
  31.         Assert.assertTrue(driver.getTitle().contains("Мои задания"), "Login is successful!");
  32.     }
  33.  
  34.     @Test(priority = 2, description = "Add new world to dictionary")
  35.     public void AddNewWordToDictionary() {
  36.         driver.findElement(By.xpath("//*[contains(text(),'Словарь')]")).click();
  37.         driver.findElement(By.xpath("//*[@placeholder='Найти']")).sendKeys("dog");
  38.         driver.findElement(By.xpath("//*[contains(text(),'Добавить')]")).click();
  39. //        driver.findElement(By.xpath("/html/body/div[18]/div[3]/div/div[1]/a[1]")).click();
  40.  
  41.     }
  42.  
  43. //    @AfterTest
  44. //
  45. //
  46. //    public void closeBrowser() {
  47. //        driver.quit();
  48. //    }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement