series - elemn
This commit is contained in:
BIN
SeleniumBasic/geckodriver.exe
Normal file
BIN
SeleniumBasic/geckodriver.exe
Normal file
Binary file not shown.
@ -1,13 +1,15 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
|
||||
public class TabulkaTest {
|
||||
public class AlertTest {
|
||||
private WebDriver driver;
|
||||
private final String BASE_URL = "http://localhost";
|
||||
// video 33 výpis do konzole textu
|
||||
@Before
|
||||
public void setUp(){
|
||||
driver = new ChromeDriver();
|
||||
@ -15,9 +17,8 @@ public class TabulkaTest {
|
||||
}
|
||||
@Test
|
||||
public void test(){
|
||||
driver.get(BASE_URL + "/tabulka.php");
|
||||
// video 31
|
||||
driver.findElement(By.xpath("//table/tbody/tr[last()]/td[1]")).getText();
|
||||
driver.get(BASE_URL);
|
||||
|
||||
|
||||
}
|
||||
@After
|
@ -1,3 +1,5 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@ -5,18 +7,20 @@ import org.junit.Test;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
|
||||
public class ClickMeTest {
|
||||
private WebDriver driver;
|
||||
private final String BASE_URL = "http://localhost";
|
||||
private final String BASE_URL = "http://localhost/clickmebaby.php";
|
||||
@Before
|
||||
public void setUp(){
|
||||
driver = new ChromeDriver();
|
||||
System.setProperty("webdriver.gecko.driver" , "geckodriver.exe");
|
||||
driver = new FirefoxDriver();
|
||||
|
||||
}
|
||||
@Test
|
||||
public void test(){
|
||||
driver.get(BASE_URL + "/clickmebaby.php");
|
||||
driver.get(BASE_URL);
|
||||
// message jsem udělal do getText vložit "" vyjmout --> vlažit kam chci psát
|
||||
Assert.assertEquals("Inicaálizovaný počet kliků", "0", driver.findElement(By.id("clicks")).getText());
|
||||
// for cyklus zvyšování plus 1
|
@ -1,3 +1,5 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
@ -1,3 +1,5 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
@ -1,3 +1,5 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
@ -1,3 +1,5 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
40
SeleniumBasic/src/test/java/cz/lukan/TabulkaTest.java
Normal file
40
SeleniumBasic/src/test/java/cz/lukan/TabulkaTest.java
Normal file
@ -0,0 +1,40 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TabulkaTest {
|
||||
private WebDriver driver;
|
||||
private final String BASE_URL = "http://localhost";
|
||||
@Before
|
||||
public void setUp(){
|
||||
driver = new ChromeDriver();
|
||||
|
||||
}
|
||||
@Test
|
||||
public void test(){
|
||||
driver.get(BASE_URL + "/tabulka.php");
|
||||
// video 31
|
||||
driver.findElement(By.xpath("//table/tbody/tr[last()]/td[1]")).getText();
|
||||
// vide 32
|
||||
List<WebElement> rows = driver.findElements(By.xpath("//table/tbody/tr"));
|
||||
System.out.println(rows);
|
||||
for (WebElement roow : rows) {
|
||||
System.out.println(roow.getText());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@After
|
||||
public void tearDown(){
|
||||
driver.quit();
|
||||
|
||||
}
|
||||
}
|
16
SeleniumBasic/src/test/java/cz/lukan/TestSuite.java
Normal file
16
SeleniumBasic/src/test/java/cz/lukan/TestSuite.java
Normal file
@ -0,0 +1,16 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
SelectTest.class,
|
||||
ClickMeTest.class,
|
||||
XpathTest.class
|
||||
|
||||
|
||||
})
|
||||
|
||||
public class TestSuite {
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
@ -1,3 +1,5 @@
|
||||
package cz.lukan;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
Reference in New Issue
Block a user