Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.sun.org.apache.bcel.internal.generic.Select;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.chrome.ChromeDriver;
- import org.openqa.selenium.interactions.Actions;
- import org.testng.Assert;
- import org.testng.annotations.AfterTest;
- import org.testng.annotations.BeforeTest;
- import org.testng.annotations.Test;
- import java.util.concurrent.TimeUnit;
- public class addNewWordToDictionary {
- protected static WebDriver driver;
- @BeforeTest
- public void startChrome() {
- System.setProperty("webdriver.chrome.driver", "C:\\Users\\Анастасия\\Desktop\\Java for QA\\LR8\\chromedriver.exe");
- driver = new ChromeDriver();
- driver.manage().window().maximize();
- driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
- }
- @Test(priority = 1, description = "Successful login into Lingualeo")
- public void SuccessfulLoginToLinguaLeo() {
- driver.get("https://lingualeo.com/ru/login");
- driver.findElement(By.xpath("//*[@id=\"email\"]")).sendKeys("adikalova@gmail.com");
- driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("A771d6552");
- driver.findElement(By.xpath("/html/body/div[1]/div[2]/div/div[1]/div[3]/form/input[4]")).click();
- Assert.assertTrue(driver.getTitle().contains("Мои задания"), "Login is successful!");
- }
- public static void sleep(int time) {
- try {
- // thread to sleep for 1000 milliseconds
- Thread.sleep(time * 1000);
- } catch (Exception e) {
- System.out.println(e);
- }
- }
- @Test(priority = 2, description = "Add new world to dictionary")
- public void AddNewWordToDictionary(){
- driver.findElement(By.xpath("//*[contains(text(),'Словарь')]")).click();
- driver.findElement(By.xpath("//*[@placeholder='Найти']")).sendKeys("dog");
- driver.findElement(By.xpath("//*[contains(text(),'Добавить')]")).click();
- driver.findElement(By.cssSelector("button[type='submit'][class='btn find-word']")).click();
- driver.findElement(By.cssSelector("[class='icons-word-check transword__check'])")).click();
- sleep(2);
- // 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 — собака");
- }
- // @AfterTest
- //
- //
- // public void closeBrowser() {
- // driver.quit();
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement