Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import org.openqa.selenium.*;
- import org.openqa.selenium.By.ById;
- import org.openqa.selenium.chrome.*;
- import org.openqa.selenium.support.ui.Select;
- import com.thoughtworks.selenium.webdriven.commands.IsSomethingSelected;
- import static org.junit.Assert.assertTrue;
- import org.junit.Assert;
- import org.junit.Test;
- public class GoogleSearchTest {
- /**
- * @param Args
- * @throws InterruptedException
- */
- public static void main(String Args[]) throws InterruptedException {
- String title;
- String projectPath = System.getProperty("user.dir");
- System.out.println(projectPath);
- System.setProperty("webdriver.chrome.driver", "E://Programy//Eclipse//chromedriver_win32/chromedriver.exe");
- WebDriver driver = new ChromeDriver();
- /*
- driver.get("https://www.trojmiasto.pl/");
- WebElement szukaj = driver.findElement(By.xpath("/html/body/div[2]/div[1]/section[2]/div[1]/div[2]/form/input[2]"));
- szukaj.sendKeys("nieruchomości");
- Thread.sleep(5000);
- szukaj.submit();
- */
- //driver.get("http://localhost:1234/#/reports/config/addConfig");
- /*
- driver.get("http://the-internet.herokuapp.com/checkboxes");
- WebElement szukaj = driver.findElement(By.xpath("/html/body/div[2]/div/div/form/input[1]"));
- Thread.sleep(5000);
- if (szukaj.isSelected())
- {
- szukaj.click();
- }
- */
- /*
- driver.get("http://the-internet.herokuapp.com/dropdown");
- Select s = new Select(driver.findElement(By.id("dropdown")));
- s.selectByValue("2");
- driver.get("http://the-internet.herokuapp.com/add_remove_elements/");
- WebElement szukaj = driver.findElement(By.xpath(" /html/body/div[2]/div/div/button"));
- Thread.sleep(3000);
- szukaj.click();
- WebElement szukaj2 = driver.findElement(By.xpath("/html/body/div[2]/div/div/div/button\r\n"+ " "));
- Thread.sleep(5000);
- szukaj2.click();
- Thread.sleep(5000);
- assertTrue(driver.findElement(By.xpath(" /html/body/div[2]/div/div/button")).isDisplayed());
- driver.get("http://the-internet.herokuapp.com/");
- //Assert.assertEquals(driver.findElement(By.xpath("/html/body/div[2]/div/h1")).getText(), "Welcome to the-internet asas");
- */
- driver.get("http://localhost:1234/#/reports");
- driver.manage().window().maximize();
- WebElement nazwaSerwera = driver.findElement(By.xpath("/html/body/div[1]/div/section/section/div/div/div[3]/div/a/div[2]/div[2]/div"));
- Thread.sleep(2000);
- nazwaSerwera.click();
- Thread.sleep(2000);
- WebElement nazwaSerwera1 = driver.findElement(By.xpath("/html/body/div/div/section/div/div/div/div[1]/div/div/div[1]/a"));
- nazwaSerwera1.click();
- Thread.sleep(2000);
- WebElement nazwaSerwera2 = driver.findElement(By.xpath(" /html/body/div/div/header/div/header[2]/div/div[2]/a/button/span"));
- nazwaSerwera2.click();
- Thread.sleep(2000);
- driver.navigate().refresh();
- Thread.sleep(2000);
- //nazwa serwera
- driver.findElement(By.xpath("/html/body/div[1]/div/section/div[2]/div/form/div/div[1]/div[3]/div/div/div/div[1]/div/input")).sendKeys("L1WW291/SQLEXPRESS03");
- Thread.sleep(2000);
- //nazwa bazy danych
- driver.findElement(By.xpath("/html/body/div/div/section/div[2]/div/form/div/div[1]/div[4]/div/div/div/div[1]/div/input")).sendKeys("wcyw1t");
- Thread.sleep(2000);
- //login
- driver.findElement(By.xpath("/html/body/div[1]/div/section/div[2]/div/form/div/div[1]/div[5]/div/div/div/div[1]/div/input")).sendKeys("stamina");
- Thread.sleep(1000);
- //hasło
- driver.findElement(By.xpath("/html/body/div[1]/div/section/div[2]/div/form/div/div[1]/div[6]/div/div/div/div[1]/div[1]/input")).sendKeys("stamina");
- Thread.sleep(1000);
- //wciśnięcie przysicku Test połączenia
- WebElement przyciskTestPolaczenia = driver.findElement(By.xpath("/html/body/div[1]/div/section/div[2]/div/form/div/div[2]/div/div/button[1]/span[1]"));
- Thread.sleep(1000);
- przyciskTestPolaczenia.click();
- //sprawdzenie, czy na przycisku jest napis "Test połączenia"
- //Assert.assertEquals(driver.findElement(By.xpath("/html/body/div[1]/div/section/div[2]/div/form/div/div[2]/div/div/button[1]/span[1]")).getText(), "Test połączeń");
- }}
Add Comment
Please, Sign In to add comment