[英]If statment ignored inside @Test in Selenium webdrive with Java
[英]Is there any dummy project test cases for webdrive selenium in java?
我是Selenium WebDrive的初学者。 是否有任何虚拟项目或测试用例可以帮助我开始学习? 您能否提出一些起点?
您可以只使用一个伪类,如下所示。
import static org.junit.Assert.fail;
import java.util.concurrent.TimeUnit;
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.firefox.FirefoxDriver;
public class TestExample {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://localhost:8080";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testExample() throws Exception {
driver.get(baseUrl);
}
@After
public void tearDown() throws Exception {
driver.quit();
}
}
只需确保您的pom中有带有junit的Selenium Maven存储库即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.