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.firefox.FirefoxDriver; // for Firefox /** * 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 geckodriver for selenium, visit https://github.com/mozilla/geckodriver/releases */ class EmptyTemplateForFirefox_Test { private WebDriver driver; private String url = "http://www.google.com"; @BeforeEach void setUp() throws Exception { System.setProperty("webdriver.gecko.driver", "path/to/geckodriver"); // configure path to the driver driver = new FirefoxDriver(); // 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 } }