| <#assign licenseFirst = "/*"> |
| <#assign licensePrefix = " * "> |
| <#assign licenseLast = " */"> |
| <#include "../Licenses/license-${project.license}.txt"> |
| <#if package?? && package != ""> |
| package ${package}; |
| </#if> |
| |
| import org.junit.Test; |
| import org.openqa.selenium.WebDriver; |
| import org.openqa.selenium.firefox.FirefoxDriver; |
| import org.openqa.selenium.support.ui.ExpectedCondition; |
| import org.openqa.selenium.support.ui.WebDriverWait; |
| |
| /** |
| * |
| * @author ${user} |
| */ |
| public class ${name} { |
| |
| @Test |
| public void testSimple() throws Exception { |
| // Create a new instance of the Firefox driver |
| // Notice that the remainder of the code relies on the interface, |
| // not the implementation. |
| WebDriver driver = new FirefoxDriver(); |
| |
| // And now use this to visit NetBeans |
| driver.get("http://www.netbeans.org"); |
| // Alternatively the same thing can be done like this |
| // driver.navigate().to("http://www.netbeans.org"); |
| |
| // Check the title of the page |
| // Wait for the page to load, timeout after 10 seconds |
| (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() { |
| @Override |
| public Boolean apply(WebDriver d) { |
| return d.getTitle().contains("NetBeans"); |
| } |
| }); |
| |
| //Close the browser |
| driver.quit(); |
| } |
| |
| } |