package web.test; // update this line based on where your test is import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; // for chrome /** * It's always a good idea to document the versions you use. * Software is updated often. One major source of problems is incompatibility issue. * * Note: (be sure to check for version compatibility - driver, selenium, browser) * * Test environment: * Firefox: version-you-use * selenium: version-you-use * Java: version-you-use * Chrome: version-you-use * geckodriver: version-you-use * JUnit 5 * * To download chromedriver for selenium, visit https://chromedriver.chromium.org/downloads */ class EmptyTemplateForChrome_Test { private WebDriver driver; private String url = "http://www.google.com"; @BeforeEach void setUp() throws Exception { System.setProperty("webdriver.chrome.driver", "path/to/chromedriver"); // configure path to the driver driver = new ChromeDriver(); // create an instance of the web browser and open it driver.get(url); // open the given url } @AfterEach void tearDown() throws Exception { driver.quit(); // close the browser } @Test public void test_openURL() { assertEquals(driver.getTitle(), "Google"); // check if we are on the right page } }