WebDriver中使用IE测试
2012-12-12 18:29:19 来源:原创 评论:0 点击:
我使用IE浏览器Driver来使用WebDriver时,遇到了一些问题,故记录如下关键点位:文本中的ie处,另外需要下载IEdriverserver.exe放在对应的l...
我使用IE浏览器Driver来使用WebDriver时,遇到了一些问题,故记录如下
关键点位:文本中的ie处,另外需要下载IEdriverserver.exe放在对应的lib文件上。
package baidu;
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.Select;
public class baiduTest {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
//IE配置项。
//.\\lib\\IEDriverServer.exe 是lib目次下的驱动
System.setProperty("webdriver.ie.driver", ".\\lib\\IEDriverServer.exe");
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true);
driver = new InternetExplorerDriver(capabilities);
//driver = new FirefoxDriver(); 为火狐浏览器的设置。火狐为默认
安装路径,无需driverservier.exe
baseUrl = "http://www.baidu.com/";
//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECOND
分享到:
收藏

评论排行
- ·B/S常用自动化工具对比(1)