все сделано
This commit is contained in:
parent
9d8b87da1b
commit
e58408844a
40
kurnaev/src/test/java/GithubUserSearch.java
Normal file
40
kurnaev/src/test/java/GithubUserSearch.java
Normal file
@ -0,0 +1,40 @@
|
||||
import context.ChromeContext;
|
||||
import context.Context;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openqa.selenium.Dimension;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import page.SearchPage;
|
||||
|
||||
|
||||
public class GithubUserSearch {
|
||||
private final static String APP_URL = "https://github.com/";
|
||||
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResultPageHeader() {
|
||||
context.getDriver().get(APP_URL);
|
||||
String searchString = "romanov73";
|
||||
|
||||
SearchPage page = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
page.setSearchString(searchString);
|
||||
page.clickSubmitButton();
|
||||
page.clickUsersLink();
|
||||
Assertions.assertTrue(page.isUserPresent());
|
||||
}
|
||||
}
|
55
kurnaev/src/test/java/Navigation.java
Normal file
55
kurnaev/src/test/java/Navigation.java
Normal file
@ -0,0 +1,55 @@
|
||||
import context.ChromeContext;
|
||||
import context.Context;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openqa.selenium.Dimension;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import page.ForumPage;
|
||||
import page.MainPage;
|
||||
import page.SearchPage;
|
||||
|
||||
|
||||
public class Navigation {
|
||||
private final static String APP_URL = "http://gmt-max.net/";
|
||||
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
//context.close();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testResultPageHeader() {
|
||||
context.getDriver().get(APP_URL);
|
||||
int elementMenu = 3;
|
||||
|
||||
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
mainPage.clickMenu(elementMenu);
|
||||
// Assertions.assertTrue(page.isUserPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResultExternalReference() {
|
||||
context.getDriver().get(APP_URL);
|
||||
int elementMenu = 1;
|
||||
|
||||
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
mainPage.clickMenu(elementMenu);
|
||||
|
||||
ForumPage forumPage = PageFactory.initElements(context.getDriver(), ForumPage.class);
|
||||
|
||||
Assertions.assertTrue(forumPage.isTableGMT());
|
||||
|
||||
}
|
||||
}
|
24
kurnaev/src/test/java/context/ChromeContext.java
Normal file
24
kurnaev/src/test/java/context/ChromeContext.java
Normal file
@ -0,0 +1,24 @@
|
||||
package context;
|
||||
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
|
||||
public class ChromeContext extends Context {
|
||||
private final static String WINDOWS_DRIVER = "chromedriver.exe";
|
||||
private final static String LINUX_DRIVER = "chromedriver";
|
||||
private final static String DRIVER_TYPE = "webdriver.chrome.driver";
|
||||
|
||||
@Override
|
||||
protected void createDriver() {
|
||||
driver = new ChromeDriver();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverExecutable(boolean isWindows) {
|
||||
return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverType() {
|
||||
return DRIVER_TYPE;
|
||||
}
|
||||
}
|
43
kurnaev/src/test/java/context/Context.java
Normal file
43
kurnaev/src/test/java/context/Context.java
Normal file
@ -0,0 +1,43 @@
|
||||
package context;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public abstract class Context {
|
||||
private final static String DRIVER_LOCATION = "drivers/%s";
|
||||
protected WebDriver driver;
|
||||
|
||||
public WebDriver getDriver() {
|
||||
if (driver != null) {
|
||||
return driver;
|
||||
}
|
||||
throw new IllegalStateException("WebDriver is not initialized");
|
||||
}
|
||||
|
||||
public void start() {
|
||||
System.setProperty(getDriverType(), getDriverExecutablePath());
|
||||
createDriver();
|
||||
// это плохая инструкция для автотестов, т.к. лучше задавать для конкретного элемента или кейса
|
||||
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
protected abstract void createDriver();
|
||||
|
||||
protected abstract String getDriverType();
|
||||
|
||||
protected abstract String getDriverExecutable(boolean windows);
|
||||
|
||||
private String getDriverExecutablePath() {
|
||||
return Context.class.getClassLoader().getResource(
|
||||
String.format(DRIVER_LOCATION, getDriverExecutable(isWindows()))).getFile();
|
||||
}
|
||||
|
||||
private boolean isWindows() {
|
||||
return System.getProperty("os.name").toLowerCase().contains("windows");
|
||||
}
|
||||
}
|
24
kurnaev/src/test/java/context/FirefoxContext.java
Normal file
24
kurnaev/src/test/java/context/FirefoxContext.java
Normal file
@ -0,0 +1,24 @@
|
||||
package context;
|
||||
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
|
||||
public class FirefoxContext extends Context {
|
||||
private final static String WINDOWS_DRIVER = "geckodriver.exe";
|
||||
private final static String LINUX_DRIVER = "geckodriver";
|
||||
private final static String DRIVER_TYPE = "webdriver.gecko.driver";
|
||||
|
||||
@Override
|
||||
protected void createDriver() {
|
||||
driver = new FirefoxDriver();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverExecutable(boolean isWindows) {
|
||||
return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverType() {
|
||||
return DRIVER_TYPE;
|
||||
}
|
||||
}
|
34
kurnaev/src/test/java/page/ForumPage.java
Normal file
34
kurnaev/src/test/java/page/ForumPage.java
Normal file
@ -0,0 +1,34 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ForumPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".ipsBox.table_wrap")
|
||||
private WebElement tableGMT;
|
||||
|
||||
public ForumPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
/*public SearchPage setSearchString(String text) {
|
||||
inputField.sendKeys(text);
|
||||
return this;
|
||||
}*/
|
||||
public void clickMenu(int number) {
|
||||
//elementMenu.get(number).click();
|
||||
}
|
||||
|
||||
/*public void clickUsersLink() {
|
||||
usersLink.click();
|
||||
}*/
|
||||
|
||||
public boolean isTableGMT() {
|
||||
return tableGMT.isDisplayed();
|
||||
}
|
||||
}
|
39
kurnaev/src/test/java/page/MainPage.java
Normal file
39
kurnaev/src/test/java/page/MainPage.java
Normal file
@ -0,0 +1,39 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".subnav li")
|
||||
private List<WebElement> elementMenu;
|
||||
|
||||
@FindBy(xpath = "//*[@class='menu border']/a[7]")
|
||||
private WebElement usersLink;
|
||||
|
||||
public MainPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
/*public SearchPage setSearchString(String text) {
|
||||
inputField.sendKeys(text);
|
||||
return this;
|
||||
}*/
|
||||
|
||||
public void clickMenu(int number) {
|
||||
elementMenu.get(number).click();
|
||||
}
|
||||
|
||||
/*public void clickUsersLink() {
|
||||
usersLink.click();
|
||||
}*/
|
||||
|
||||
public boolean isUserPresent() {
|
||||
return driver.findElement(By.cssSelector(".user-list-info")).isDisplayed();
|
||||
}
|
||||
}
|
997
kurnaev/src/test/java/page/Search.java
Normal file
997
kurnaev/src/test/java/page/Search.java
Normal file
@ -0,0 +1,997 @@
|
||||
package page;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
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.chrome.ChromeOptions;
|
||||
import java.nio.file.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.Scanner;
|
||||
import java.util.*;
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
|
||||
public class Search
|
||||
{
|
||||
//test 1 Верхнее меню. "Верхнем меню кликнуть на любой пункт кроме «Форум» "FAQ""
|
||||
// переход на вкладку "Правила"
|
||||
public static void Test1()
|
||||
{
|
||||
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try
|
||||
{
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("(//html/body/div[@class='main_head']/div[@id='overview']/div[@class='subnav']/div[@class='content']/ul[@class='navigation']/li[4]/a)")).click();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Страница игры "Кликнуть по названию игры в превью на главной странице"
|
||||
public static void Test2()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("(//li[@class='sliderElement rad3'])[2]")).click();
|
||||
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Боковой список "Кликнуть по названию игры в боковом списке "популярные раздачи""
|
||||
public static void Test3()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("(//html/body/div[@class='content_main']/div[@class='main_right_col blocks']/a[@class='popular_torrents'][2])")).click();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Внешние ссылки "Кликнуть в верхнем меню на пункт меню "Форум""
|
||||
public static void Test4()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//a[@href='/forum/']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Внешняя ссылка на последнее сообщение на форуме
|
||||
//Кликнуть на последнее название темы в списке «Последнее сообщение на форме»
|
||||
public static void Test5()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//html/body/div[@class='content'][1]/div[@class='forum_block']/div[@class='forum_msg_block']/div[@class='ltContent']/table/tbody/tr[7]/td[@class='topicInfo']/a[@class='topicLink']")).click();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Вытесняющее меню "Кликнуть по жанру в блоке «Навигация» Кликнуть на любой пункт"
|
||||
public static void Test6()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='content_main']/div[@class='main_left_col blocks']/div[@id='firstpane'][2]/p[@class='menu_head1'][3]")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='content_main']/div[@class='main_left_col blocks']/div[@id='firstpane'][2]/div[@class='menu_body'][3]/a[2]")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Скачивание файла "проверку на робота! чтобы тест прошел надо самому проходить проверку"
|
||||
public static void Test7()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver();
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='content_main']/div[@class='main_center_col blocks']/div[@id='dle-content']/div[@class='short_news_title'][2]/div[@class='short_news_title_center']/a")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//a[starts-with(@href,'/go.php?url=https://downloads-torrent.ru')]")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
ArrayList tabs1 = new ArrayList<String>(driver.getWindowHandles());
|
||||
driver.switchTo().window(tabs1.get(1).toString());
|
||||
|
||||
driver.findElement(By.xpath("//html/body[@class='rectangles']/main[@class='fill']/section[@class='section section--fill']/div[@class='container no-index']/div[@class='block block-download']/a[@id='btn--download']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(15);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Картинки в описании игры Кликнуть по названию игры
|
||||
//Проверка на наличие картинок в описание игры
|
||||
//Раньше в привью была игра без картинок в описании так что проверяю у определенной
|
||||
public static void Test8()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//a[@href='/action/9369-counter-strike-global-offensive-2017-rus-eng-repack-nosteam-servers.html']")).click();
|
||||
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
for (int i = 2; i < 8; i++) {
|
||||
WebElement ImageFile = driver.findElement(By.xpath("//img[starts-with(@src,'http://paypic.kz/allimage/2/2797" + i + "-thumb.jpeg')]"));
|
||||
|
||||
Boolean ImagePresent = (Boolean) ((JavascriptExecutor) driver).executeScript("return arguments[0].complete && typeof arguments[0].naturalWidth != \"undefined\" && arguments[0].naturalWidth > 0", ImageFile);
|
||||
if (!ImagePresent) {
|
||||
} else {
|
||||
System.out.println("Image displayed.");
|
||||
break;
|
||||
}
|
||||
if (i == 7) {
|
||||
System.out.println("Image not displayed.");
|
||||
}
|
||||
}
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Поиск по сайту "В страку «Поиск по трекеру» ввести например «Skyrim»"
|
||||
public static void Test9()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
WebElement s1 = driver.findElement(By.id("story"));
|
||||
s1.sendKeys("Skyrim" + "\n");
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Поиск по сайту с пустым значением"
|
||||
// В строку «Поиск по трекеру» нечего не введя нажать на поиск/Enter"
|
||||
public static void Test10()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
WebElement s1 = driver.findElement(By.id("story"));
|
||||
s1.sendKeys("\n");
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Сортировка На главной странице кликнуть на «РПГ» в блоке «Навигация»
|
||||
//Кликнуть по надписи «ММОРПГ» в выпавшем меню
|
||||
public static void Test11()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='content_main']/div[@class='main_left_col blocks']/div[@id='firstpane'][2]/p[@class='menu_head1'][3]")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='content_main']/div[@class='main_left_col blocks']/div[@id='firstpane'][2]/div[@class='menu_body'][3]/a[2]")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Фильтрация результатов запроса Выполнить поиск по сайту «Skyrim»
|
||||
//Кликнуть по кнопке «Расширенный поиск»
|
||||
//Добавить условие имя пользователя «MAX»
|
||||
public static void Test12()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
WebElement s1 = driver.findElement(By.id("story"));
|
||||
s1.sendKeys("Skyrim" + "\n");
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='content_main']/div[@class='main_center_col blocks']/div[@id='dle-content']/div[@class='dpad radial infoblock']/div[@id='searchtable']/form[@id='fullsearch']/table/tbody/tr/td[@class='search']/div/input[@id='dofullsearch']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
WebElement s2 = driver.findElement(By.id("searchuser"));
|
||||
s2.sendKeys("Max" + "\n");
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Фильтрация «Все раздачи» Кликнуть по меню «Все раздачи»
|
||||
//Выставить значение фильтра по статусу «Мертвые»
|
||||
public static void Test13()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//html/body/div[@class='main_head']/div[@id='overview']/div[@class='subnav']/div[@class='content']/ul[@class='navigation']/li[5]/a")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
WebElement mySelectElement = driver.findElement(By.name("status"));
|
||||
Select dropdown = new Select(mySelectElement);
|
||||
dropdown.selectByIndex(4);
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Вход в систему В шапке сайта нажать на кнопку «Вход»
|
||||
//В открывшемся окне заполнить логин и пароль и нажать «Вход»
|
||||
public static void Test14()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//html/body/div[@class='main_head']/div[@class='content']/div[@class='login_block']/span/a[@id='loginlinkreg']")).click();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
WebElement s1 = driver.findElement(By.id("login_name"));
|
||||
s1.sendKeys("g35hfsd");
|
||||
|
||||
WebElement s2 = driver.findElement(By.id("login_password"));
|
||||
s2.sendKeys("hfgn53fgb");
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable']/div[@id='logindialogreg']/center/form/button[@class='fbutton']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Выход из системы В шапке сайта нажать на «Крестик» рядом с логином пользователя
|
||||
public static void Test15()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//html/body/div[@class='main_head']/div[@class='content']/div[@class='login_block']/span/a[@id='loginlinkreg']")).click();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
WebElement s1 = driver.findElement(By.id("login_name"));
|
||||
s1.sendKeys("g35hfsd");
|
||||
|
||||
WebElement s2 = driver.findElement(By.id("login_password"));
|
||||
s2.sendKeys("hfgn53fgb");
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable']/div[@id='logindialogreg']/center/form/button[@class='fbutton']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='main_head']/div[@class='content']/div[@class='login_block']/a")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Регистрация второго аккаунта с одного и того же IP
|
||||
// "Кликнуть на надпись «Регистрация» в шапке сайта. "
|
||||
public static void Test16()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//html/body/div[@class='main_head']/div[@class='content']/div[@class='login_block']/span/a[2]")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Вход с поролем но без логина В шапке сайта нажать на кнопку «Вход»
|
||||
//В открывшемся окне не заполнять логин , но ввести пароль и нажать «Вход»
|
||||
public static void Test17()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//html/body/div[@class='main_head']/div[@class='content']/div[@class='login_block']/span/a[@id='loginlinkreg']")).click();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
|
||||
WebElement s2 = driver.findElement(By.id("login_password"));
|
||||
s2.sendKeys("hfgn53fgb");
|
||||
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable']/div[@id='logindialogreg']/center/form/button[@class='fbutton']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Вход с логином но без пароля В шапке сайта нажать на кнопку «Вход»
|
||||
//В открывшемся окне заполнять логин , но не вводить пароль и нажать «Вход»
|
||||
public static void Test18()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//html/body/div[@class='main_head']/div[@class='content']/div[@class='login_block']/span/a[@id='loginlinkreg']")).click();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
|
||||
WebElement s1 = driver.findElement(By.id("login_name"));
|
||||
s1.sendKeys("g35hfsd");
|
||||
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable']/div[@id='logindialogreg']/center/form/button[@class='fbutton']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Вход в систему с большой строкой вместо логина В шапке сайта нажать на кнопку «Вход»
|
||||
//В открывшемся окне заполнять логин большим количеством символов, но ввести пароль правильно и нажать «Вход»
|
||||
public static void Test19()
|
||||
{
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5); // Same as Thread.sleep(5000);
|
||||
// The "main" thread will sleep
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//html/body/div[@class='main_head']/div[@class='content']/div[@class='login_block']/span/a[@id='loginlinkreg']")).click();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5); // Same as Thread.sleep(5000);
|
||||
// The "main" thread will sleep
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
WebElement s1 = driver.findElement(By.id("login_name"));
|
||||
s1.sendKeys("g35hfsd54hfcnr674wshfgnr6e756jhdfer5346ydfjh657");
|
||||
|
||||
WebElement s2 = driver.findElement(By.id("login_password"));
|
||||
s2.sendKeys("hfgn53fgb");
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2); // Same as Thread.sleep(5000);
|
||||
// The "main" thread will sleep
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable']/div[@id='logindialogreg']/center/form/button[@class='fbutton']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5); // Same as Thread.sleep(5000);
|
||||
// The "main" thread will sleep
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
//Добавление игр в закладки Кликнуть по значку в строчке с названием игры «Добавить в закладки»
|
||||
public static void Test20()
|
||||
{
|
||||
|
||||
Path currentRelativePath = Paths.get("");
|
||||
String s = currentRelativePath.toAbsolutePath().toString();
|
||||
|
||||
File file = new File(s + "/src/main/resources/drivers/chromedriver.exe");
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--disable-notifications");
|
||||
|
||||
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
|
||||
WebDriver driver = new ChromeDriver(options);
|
||||
driver.get("http://gmt-max.net/");
|
||||
try
|
||||
{
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
driver.findElement(By.xpath("//html/body/div[@class='main_head']/div[@class='content']/div[@class='login_block']/span/a[@id='loginlinkreg']")).click();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
WebElement s1 = driver.findElement(By.id("login_name"));
|
||||
s1.sendKeys("g35hfsd");
|
||||
|
||||
WebElement s2 = driver.findElement(By.id("login_password"));
|
||||
s2.sendKeys("hfgn53fgb");
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable']/div[@id='logindialogreg']/center/form/button[@class='fbutton']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.findElement(By.xpath("//html/body/div[@class='content_main']/div[@class='main_center_col blocks']/div[@id='dle-content']/div[@class='short_news_title'][1]/div[@class='edit_news_block']/a[@id='fav-id-12324']")).click();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
driver.quit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("There is error");
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
public static void main (String[] args)
|
||||
{
|
||||
String y;
|
||||
int u;
|
||||
boolean b = true;
|
||||
Scanner scan = new Scanner(System.in);
|
||||
while(b) {
|
||||
System.out.print("Enter number 0 for all tests, 1-20 for one test and 21 to exit: ");
|
||||
y = scan.nextLine();
|
||||
try {
|
||||
u = Integer.parseInt(y);
|
||||
|
||||
if(u<0 || u>21)
|
||||
{
|
||||
b = true;
|
||||
}
|
||||
else if(u==21)
|
||||
{
|
||||
b = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (u)
|
||||
{
|
||||
case 0: Test1();
|
||||
Test2();
|
||||
Test3();
|
||||
Test4();
|
||||
Test5();
|
||||
Test6();
|
||||
Test7();
|
||||
Test8();
|
||||
Test9();
|
||||
Test10();
|
||||
Test11();
|
||||
Test12();
|
||||
Test13();
|
||||
Test14();
|
||||
Test15();
|
||||
Test16();
|
||||
Test17();
|
||||
Test18();
|
||||
Test19();
|
||||
Test20();
|
||||
break;
|
||||
case 1: Test1();
|
||||
break;
|
||||
case 2: Test2();
|
||||
break;
|
||||
case 3: Test3();
|
||||
break;
|
||||
case 4: Test4();
|
||||
break;
|
||||
case 5: Test5();
|
||||
break;
|
||||
case 6: Test6();
|
||||
break;
|
||||
case 7: Test7();
|
||||
break;
|
||||
case 8: Test8();
|
||||
break;
|
||||
case 9: Test9();
|
||||
break;
|
||||
case 10: Test10();
|
||||
break;
|
||||
case 11: Test11();
|
||||
break;
|
||||
case 12: Test12();
|
||||
break;
|
||||
case 13: Test13();
|
||||
break;
|
||||
case 14: Test14();
|
||||
break;
|
||||
case 15: Test15();
|
||||
break;
|
||||
case 16: Test16();
|
||||
break;
|
||||
case 17: Test17();
|
||||
break;
|
||||
case 18: Test18();
|
||||
break;
|
||||
case 19: Test19();
|
||||
break;
|
||||
case 20: Test20();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//Test1();
|
||||
}
|
||||
}
|
||||
|
38
kurnaev/src/test/java/page/SearchPage.java
Normal file
38
kurnaev/src/test/java/page/SearchPage.java
Normal file
@ -0,0 +1,38 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class SearchPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = "input.header-search-input")
|
||||
private WebElement inputField;
|
||||
|
||||
@FindBy(xpath = "//*[@class='menu border']/a[7]")
|
||||
private WebElement usersLink;
|
||||
|
||||
public SearchPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public SearchPage setSearchString(String text) {
|
||||
inputField.sendKeys(text);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void clickSubmitButton() {
|
||||
inputField.sendKeys(Keys.RETURN);
|
||||
}
|
||||
|
||||
public void clickUsersLink() {
|
||||
usersLink.click();
|
||||
}
|
||||
|
||||
public boolean isUserPresent() {
|
||||
return driver.findElement(By.cssSelector(".user-list-info")).isDisplayed();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user