Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. import com.sun.org.apache.bcel.internal.generic.Select;
  2. import org.openqa.selenium.By;
  3. import org.openqa.selenium.WebDriver;
  4. import org.openqa.selenium.WebElement;
  5. import org.openqa.selenium.chrome.ChromeDriver;
  6. import org.openqa.selenium.interactions.Actions;
  7. import org.testng.Assert;
  8. import org.testng.annotations.AfterTest;
  9. import org.testng.annotations.BeforeTest;
  10. import org.testng.annotations.Test;
  11.  
  12. import java.util.concurrent.TimeUnit;
  13.  
  14. public class addNewWordToDictionary {
  15.  
  16. protected static WebDriver driver;
  17.  
  18.  
  19.  
  20. @BeforeTest
  21. public void startChrome() {
  22. System.setProperty("webdriver.chrome.driver", "C:\\Users\\Анастасия\\Desktop\\Java for QA\\LR8\\chromedriver.exe");
  23. driver = new ChromeDriver();
  24.  
  25. driver.manage().window().maximize();
  26. driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
  27. }
  28.  
  29.  
  30. @Test(priority = 1, description = "Successful login into Lingualeo")
  31. public void SuccessfulLoginToLinguaLeo() {
  32. driver.get("https://lingualeo.com/ru/login");
  33. driver.findElement(By.xpath("//*[@id=\"email\"]")).sendKeys("adikalova@gmail.com");
  34. driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("A771d6552");
  35. driver.findElement(By.xpath("/html/body/div[1]/div[2]/div/div[1]/div[3]/form/input[4]")).click();
  36.  
  37. Assert.assertTrue(driver.getTitle().contains("Мои задания"), "Login is successful!");
  38.  
  39.  
  40. }
  41. public static void sleep(int time) {
  42. try {
  43. // thread to sleep for 1000 milliseconds
  44. Thread.sleep(time * 1000);
  45. } catch (Exception e) {
  46. System.out.println(e);
  47. }
  48. }
  49. @Test(priority = 2, description = "Add new world to dictionary")
  50. public void AddNewWordToDictionary(){
  51. driver.findElement(By.xpath("//*[contains(text(),'Словарь')]")).click();
  52. driver.findElement(By.xpath("//*[@placeholder='Найти']")).sendKeys("dog");
  53. driver.findElement(By.xpath("//*[contains(text(),'Добавить')]")).click();
  54.  
  55.  
  56. driver.findElement(By.cssSelector("button[type='submit'][class='btn find-word']")).click();
  57. driver.findElement(By.cssSelector("[class='icons-word-check transword__check'])")).click();
  58. sleep(2);
  59.  
  60.  
  61. // Assert.assertEquals(driver.findElement(By.xpath("//*[@id=\"glossaryPage\"]/div[3]/div[2]/div[2]/div[1]/div[1]/div[2]/div/div[6]")).getText(),"dog — собака");
  62.  
  63. }
  64.  
  65. // @AfterTest
  66. //
  67. //
  68. // public void closeBrowser() {
  69. // driver.quit();
  70. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement