import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.Assert; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class TestSzit { WebDriver driver; @BeforeTest public void initTest() { driver = new ChromeDriver(); } @BeforeMethod public void initMethods() { driver.get("https://szit.hu"); } @Test public void testRecept() { WebElement elem = driver.findElement(By.name("q")); elem.sendKeys("recept" + Keys.ENTER); boolean actual = driver.getPageSource().contains("Gluténmentes"); Assert.assertTrue(actual); } @Test public void testAngularContent() { WebElement elem = driver.findElement(By.name("q")); elem.sendKeys("Angular" + Keys.ENTER); boolean actual = driver.getPageSource().contains("Angular"); Assert.assertTrue(actual); } @AfterTest public void endTest() { driver.quit(); } }