import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
public class CopyOfOtkryt {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "
http://www.okidoki.ee/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testCopyOfOtkryt() throws Exception {
driver.get(baseUrl + "/");
driver.findElement(By.cssSelector("a > b")).click();
driver.findElement(By.id("forlogin")).clear();
driver.findElement(By.id("forlogin")).sendKeys("${LoginName}");
System.out.println("Пользователь - ${LoginName}");
driver.findElement(By.id("forpassword")).clear();
driver.findElement(By.id("forpassword")).sendKeys("${WrongPas}");
driver.findElement(By.id("fexpires")).click();
driver.findElement(By.cssSelector("p > input[type=\"submit\"]")).click();
System.out.println("Sisestasid vale kasutajanime või parooli.");
driver.findElement(By.id("forlogin")).clear();
driver.findElement(By.id("forlogin")).sendKeys("${LoginName}");
driver.findElement(By.id("forpassword")).clear();
driver.findElement(By.id("forpassword")).sendKeys("${CorrectPas}");
driver.findElement(By.cssSelector("p > input[type=\"submit\"]")).click();
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
}
Прикрепленные файлы
-
dr.JPG 51,44К
10 Количество загрузок: